Autocomplete Ajax:
$(“#name”).autocomplete({
source: function (request, response) {
$.ajax({
url: “/Controller/Action”,
data: “{ ‘name’: ‘” + request.term + “‘ }”,
dataType: “json”,
type: “POST”,
contentType: “application/json; charset=utf-8”,
dataFilter: function (data) { return data; },
success: function (data) {
response($.map(data, function (item) {
//Mapping the received data
return {
value: item
}
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 1 //Length when the search will begin
});
Here is the original : AutoComplete .
Recent Comments