Beauty? I have a Json whose structure is as follows:
[{"id":1,"nome":"teste"},{"id":2,"nome":"teste"},{"id":3,"nome":"teste3"}]
I want to use it in this type head code but however it does not load ... In the browser console it shows that it loaded json correctly.
In Ajax's return, I already return with json type ...
$('#nome').typeahead({
source: function(query, process) {
objects = [];
map = {};
console.log(data);
$.each(data, function(i, object) {
map[object.label] = object;
objects.push(object.label);
});
process(objects);
},
updater: function(item) {
console.log(map[item].id);
//$('hiddenInputElement').val(map[item].id);
return item;
}
});
return error in console:
TypeError: b is undefined