I am using jqueryui autocomplete and would like to know if there is a generic way to access the Json object items using $.ajax(). In the example below, the text/value pairs are item.Title and item.AlbumId and it works fine. But I would like to know if there is a way to access it like item[0], item[1]. I tried but it does not work.
// jqueryui autocomplete configuration
$(element).autocomplete({
minLength: minimumTextLength,
source: function (req, response) {
// call $.ajax()
$.ajax({
url: filterUrl,
type: "POST",
dataType: "json",
data: { term: textbox.val() },
success: function (data) {
response($.map(data, function (item) {
return { label: item.Title, value: item.AlbumId };
}));
}
});
}
}); // end of autocomplete()