javascript - TypeHeadBootStrap does not work -
i have json has following structure:
[{"id":1,"nome":"teste"},{"id":2,"nome":"teste"},{"id":3,"nome":"teste3"}]
i want use head type code not load, in browser console shows loaded json
correctly.
$('#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; } });
i using lib: https://github.com/bassjobsen/bootstrap-3-typeahead
resolved changed library https://github.com/biggora/bootstrap-ajax-typeahead
Comments
Post a Comment