Skip to content

Instantly share code, notes, and snippets.

@kshyju
Created February 28, 2014 16:14
Show Gist options
  • Save kshyju/9273859 to your computer and use it in GitHub Desktop.
Save kshyju/9273859 to your computer and use it in GitHub Desktop.
jQuery autocomplete load data from a custom object list via ajax
$("#txtSearch").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Home/Getsrchresult",
type: "POST",
dataType: "json",
data: { term: request.term,location:$('#location').val() },
success: function (data) {
response($.map(data, function (item) {
return { label: item.srchresult+"-"+item.place, value: item.srchresult+"-"+item.place };
}))
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment