5
I’m having Autocomplete Problems, I can pull the data but autocomplete doesn’t work !
$("#marcas").autocomplete({
source: function (request, response) {
$.ajax({
type: 'GET',
url: 'http://fipeapi.appspot.com/api/1/carros/marcas.json',
dataType: 'jsonp',
crossDomain: true,
success: function (data) {
response($.map(data, function (item) {
return {
label: item.fipe_name,
id: item.id
}
}))
},
});
},
minLength: 1,
//evento de quando você seleciona uma opção
select: function (event, ui) {
//seto a descrição para aparecer para usuario no input text
$("#marcas").val(ui.item.label);
//seto o id para ir para seu backend :D
$("#idmarcas").val(ui.item.id);
event.preventDefault();
}});
The complete code can be seen here http://jsfiddle.net/juniorthiesen/3nvb4xus/
Check this out http://jsfiddle.net/gustavox/t5yL52w1/ I think we were missing the Return from
key, and then associate him with the fieldveiculo, but I’m not sure if this is the expected behavior (include thekeyin the vehicle field)...– gustavox
that was just a piece of code that was having problems, but I was able to solve with the help of Rodrigo Gomes, Thank you
– Junior Thiesen