The following autocomplete code works with jQuery 1.4.4, but not with 1.5.1. I am using jquery-ui-1.8.11. I use the selected element to populate the array, the alert () call is for testing only. I know the autocomplete error in 1.5, but thought 1.5.1 fixed it. Any ideas on what I should do to make this work in 1.5.1? My guess would be something with the json results that are listed below.
$("#selected").autocomplete({ source: function (request, response) { $.ajax({ url: autourl, type: "POST", dataType: "json", data: { query: request.term, maxResults: 10, donationid: donationid }, success: function (data) { response($.map(data, function (item) { return { Label: item.Label, value: item.Label, VolunteerID: item.VolunteerID, DisplayName: item.DisplayName, QtyFilled: item.QtyFilled } })) } }) }, select: function (event, ui) { alert(ui.item.DisplayName); } });
For 1.4 and 1.5.1, the following is returned. [{"VolunteerID": 1, "Label": "John Smith ( jsmit@domain.com )", "DisplayName": "John Smith", "FirstName": "John", "LastName": "Smith", AliasName " : null, "QtyFilled": 0}]
source share