JQuery Autocomplete does not work in 1.5.1, but worked in 1.4.4

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}]

+4
source share
2 answers

Do you accidentally use the validator plugin? There is a conflict between the previous validator plugin and any jQuery 1.5.x plugin. Downloading the updated validation plugin worked for me.

https://github.com/jzaefferer/jquery-validation

If this is not a problem, try removing any extensions and trimming the code, so all you have left is the autocomplete code.

+3
source

You can try it with jQuery v1.5.2 - disable printing: http://blog.jquery.com/2011/03/31/jquery-152-released/

0
source

Source: https://habr.com/ru/post/1346098/


All Articles