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 item to populate an array, the alert() call is just for testing purposes. I aware of an autocomplete bug in 1.5 but thought 1.5.1 fixed it. Any ideas on what I should do to get this working in 1.5.1? My guess would be something with the json results, which 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);
}
});
The following is returned for 1.4 and 1.5.1.
[{“VolunteerID”:1,”Label”:”John Smith (jsmit@domain.com)”,”DisplayName”:”John Smith”,”FirstName”:”John”,”LastName”:”Smith”,”AliasName”:null,”QtyFilled”:0}]
Are you by chance using the validator plugin? There is a conflict between a previous version of the validator plugin and any 1.5.x jquery plugin. Downloading the updated validation plugin worked for me.
https://github.com/jzaefferer/jquery-validation
If this wasn’t the issue, try removing any extensions and trim down the code so all you have left is the autocomplete code.