Currently, I have this version of the autocomplete control working when returning XML from a .ashx handler. The xml looks like this:
I got the autocomplete to work with .asmx by using JSON. Here is an example of what I did:
JavaScript:
$("#tbNameFilter").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Services/AutocompleteService.asmx/Aoi_Autocomplete",
data: "{ 'q': '" + request.term + "', 'limit': '10' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.Name,
value: item.Name
}
}))
}
});
},
minLength: 1
});
Web Service:
[WebMethod]
public List<FAD_Aoi> Aoi_Autocomplete(String q, int limit)