The autocomplete is working correctly, I get the following json:
[{"label":"Jorge Valdivia","value":"16"},{"label":"Vinicius Aquino","value":"15"}]
The problem is that when I select an option, the input receives the record ID, I would like to have it display the person's name in the input.
// -------------- Autocomplete --------------
$('#search_broker').autocomplete({
source: path + "User/get_brokers",
minLength: 2,
select: function (event, ui) {
broker_name = ui.item.label;
broker_id = ui.item.value;
alert('Nome: ' + broker_name);
}
});