I have the following gulpfile.js file to generate the css
files % and% with%. It is generating me two files:
$('#instituicao').autocomplete({
source: function (request, response) {
$.getJSON("/path/ajax", { q: request }, function(result) {
response($.map(result, function(item) {
console.log(item);
return item.nome;
}));
});
},
minLength: 5,
delay: 100
});
When I type, the object is printed on the console:
Exampleofjs
ofJSON
loaded:
Objeto
Butnotintheview'sautocompletelistbox.
<divclass="form-group">
<input type="text" autocomplete="off" id="instituicao" name="instituicao"
class="form-control" placeholder="Nome da Instituição de ensino">
</div>
What am I doing wrong?
PS: I know it's not [{"id":"7","nome":"EEEF EURIDICE LOPES PEDROSO","endereco":"aqui vir\u00e1 o endere\u00e7o"},{"id":"10","nome":"EEEFM JUSCELINO KUBITSCHEK DE OLIVEIRA","endereco":"aqui vir\u00e1 o endere\u00e7o"},{"id":"20","nome":"EEEF TANCREDO DE ALMEIDA NEVES","endereco":"aqui vir\u00e1 o endere\u00e7o"},{"id":"21","nome":"EEEFM PADRE EZEQUIEL RAMIN","endereco":"aqui vir\u00e1 o endere\u00e7o"}]
, because when I send the object this way it works:
CSS
$('#instituicao').autocomplete({
valueKey:'nome',
source: [data],
minLength: 5,
delay: 100
});