typeahead - Having trouble to typeaheadjs -
i have used following script :
<input class="typeahead" type="text" id = "input"> $('#input').typeahead([{name: 'name',remote: 'planets.json',}]);
json file
{"name" : {"value" : ["4729", "siva", "prakash"]},"planets" : {"value" : ["mercury", "venus", "pluto"]}}
while typing on input box , display 2 json array name value[name , plants]. anyway in code have mention name 'name' only. has return value 'name' json array ?
in planets.json
name->value, or planets->value. init typeahead instead :
<input type="text" id="input" data-provide="typeahead"> $.getjson("planets.json", function(json) { $('#input').typeahead({ source : json.name.value }); });
or json.planets.value
, if want planets