javascript - AutoComplete Controller Action not being called -


i have editbox linked auto-complete handler, when type character controller method not calling , not working also.

jquery

$("#nameinput").autocomplete({     minchars: 3,     delay: 100,     cachelength: 25,     autofill: true,     source: function (request, response) {         $.ajax({             url: "/data/getnames", datatype: "json",             data: { id: request.term },             success: function (data) {                 response($.map(data, function (item) {                     return { label: item.label, value: item.id }; //updated code                 }));             }         });     },     select: function (event, ui) {         return false;     } }); 

here controller method.

c#

[requiresrole(roles = "su, da, rv, sp, dg, ap, ua")] [acceptverbs(httpverbs.get)] public string getnames(string term ) {     //perform db operations     return string.empty; } 

aspx

<input type="text" name="nameinput" id="nameinput" class="nameinputfield" maxlength="80" tabindex="3" /> 

here getnames method not calling, @ time of launching i'm registering auto-complete handler. issue?

as far can see, issue lies in ajax call. in data in pass, assign request.term id - yet controller method looking parameter called term.

change ajax

data: { id: request.term } 

to

data: { term: request.term } 

alternatively, change controller method

public string getnames(string term) 

to

public string getnames(string id) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -