I want know how to use autocomplete with database using ajax and the data get faster on local server and Main server also
And i try this script
$("#SI").autocomplete({
source: function (request, response) {
$.ajax({
url: '@Url.Action("GetSearchValue","Main")',
dataType: "json",
data: { search: $("#SI").val() },
success: function (data) {
response($.map(data, function (item) {
return { label: items.Name, value: items.Name };
}));
},
error: function (xhr, status, error) {
alert("Error");
}
});
}
});