Hi there,
In an .net MVC application I have a following Ajax call that gets the names from database.
$("#searchString").focusin(function () {$("#searchString").autocomplete({
source: function (request, response) {$.ajax({
url: "/Home/GetNames",
type: "POST",
dataType: "json",
data: { Prefix: request.term },
success: function (data) {
alert("data: " + data);
response($.map(data, function (item) {
return { label: item.term, value:item.term };
}))
}
})
}
});
});The line alert(data) shows me a list of strings separated by commas that was returned from a method GetNames. I don't understand these lines and these are not working. How do I display this list of strings as this autocomplete?
Joe