0
beauty? I have a Json whose structure has following:
[{"id":1,"nome":"teste"},{"id":2,"nome":"teste"},{"id":3,"nome":"teste3"}]
I want to use it in this type head code but it does not load... In the browser console it shows that you have loaded the json correctly.
On the return of Ajax, 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;
}
});
returns error in console:
Typeerror: b is Undefined
I don’t see
b
in your code... (?)– Sergio