I'm trying to make an autocomplete using a json file but when I type on the input field, it shows nothing. I want to show only the data specified into "descricao", not into "codigo". Here is my code:
$(function() {
$('#autocompleteGrupo').autocomplete({
source: function (request, response) {
$.ajax({
url: "jsonGrupo.jsp",
dataType: 'json',
data: request,
success: function( data ) {
response( $.map( data, function( item ) {
return {
label: value,
value: item.descricao
};
}));
}
});
},
minLength: 2
});
});
my json file:
[{"codigo":"1","descricao":"Tecnologia da Informação"}]
Thanks,
Lucas.