I am getting this error in console everytime I try to run the following code
$('#autcomplete_search').typeahead({
highlight: true
},
{
name: 'apple_game',
remote: "/search/autocomplete?keyword=make"
});
Typeahead: Uncaught Error Missing source
If fetching remote, you need to specify the engine. Here is an example from the docs
var bestPictures = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../data/films/post_1960.json',
remote: '../data/films/queries/%QUERY.json'
});
bestPictures.initialize();
$('#remote .typeahead').typeahead(null, {
name: 'best-pictures',
displayKey: 'value',
source: bestPictures.ttAdapter()
});
in this example, var bestPictures
is your engine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With