В вашей разметке:
<input type="text" class="item" id="input_autocomplete_1" custom_attr="XXX" />
в вашем JS:
$('.item').autocomplete({
source: function( request, response ) {
//to send the custom attribute to the populate function
customAttr = this.element.attr('custom_attr');
$.ajax({
url: "",
dataType: "json",
data: {
term : request.term,
custom_attr: customAttr
},
success: function( data ) {
//return a json with label, id and custom
response( $.map( data, function( item ) {
return {
label: item.label,
id: item.id,
custom: item.custom
}
}));
}
});
},
select: function( event, ui ) {
//if you want to do something when the item is selected
//you can access:
//ui.item.id;
//ui.item.custom;
}
});