I'm using Typeahead.js for my autosuggestions, my code is:
var job_scopes = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.value);
},queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 100,
remote: {
url: 'http://www.domain.com/json.php?action=job_title&q=%QUERY'
}
});
job_scopes.initialize();
This works fine, however I would like to change it to prefetch
, to be able to use tokens
in my JSON and leave returning results based on tokens on Bloodhound.
I cannot simply create static JSON, as I have the suggestion items added to the db all the time.
Is there a way to prefetch the json dynamically?