I’m trying to implement autocomplete for a textbox using the following code, but it’s not working:
(The ajax call to MyUrl works fine and returns a json string made of List of strings)
$(document).ready(function () {
$(".searchbox").autocomplete({
source: function (request, response) {
$.ajax({
url: "/MyUrl/" + request.term.toLowerCase(),
dataFilter: function (data) { return data; },
success: function (data) {
return data;
}
});
},
minLength: 1
});
});
Is this call correct ?
You’re not supposed to
returnthe data, you’re supposed to pass it to theresponsecallback.Which is pretty much the same thing as: