Don’t know if it matters, but the msg.d is about 300 rows long. I get properly formatted Json data when I alert msg.d.
$("#supplierSelect").autocomplete({
source: function( request, response ) {
$.ajax({
type: "POST",
url: "SupplierAdmin.aspx/PopulateSupplierSelectDropDownList",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
response( $.map( msg.d, function( item ) {
return {
label: item.title,
value: item.turninId
}
}));
}
});
}
}).fadeIn();
Lots of thanks if you can tell me how to only fadeIn when success.
Edit: The “properly formatted Json data” actually has quotes around the label and value, and the ordering is switched. Checking now to see if it makes a difference. Sorry for incomplete info.
Edit2: I went with response( $($.parseJSON(msg.d)).map( function()… instead, and now when I type anything, the autocomplete drops down the whole list of names and selecting one puts the value in the box. Am I right to assume this isn’t correct functionality?
Needed to add parseJSON to the map.