I am using the token-input plugin in my ASP.NET project.
I have a web method as shown below,
public partial class User : System.Web.UI.Page
{
[WebMethod]
public static List<IdAndName> GetDescriptions()
{
return DBQueryManager.GetDistinctDescriptions();
}
$('#DescriptionFilterTxtBox').tokenInput("User.aspx/GetDescriptions", {
hintText: "Key in atleast 2 chars. First 20 match is displayed.",
searchDelay: 25,
minChars: 1,
resultsLimit: 10,
tokenValue: name
});
I am trying to get the data from the GetDescriptions
method and display it in the DescriptionFilterTxtBox
but, it is not working. Basically, the plugin is not able to hit the web method.
How can I hit the ASP.Net Web Method from the tokeninput plugin? Any help/suggestions are appreciated.
Your method needs the q parameter:
[WebMethod]
public static List<IdAndName> GetDescriptions(string q)
{
return DBQueryManager.GetDistinctDescriptions();
}
Your script must accept a GET parameter named q which will contain the term to search for. Eg http://www.example.com/myscript?q=query
You also need to return a JSON from the method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.