I am trying to use typeahead.js. My code looks like this:
<input id="query" type="search" class="form-control typeahead tt-query" autocomplete="off" spellcheck="false" placeholder="Search by typing anything" />
...
var URL_ROOT = '[populated on server. Something like "http://localhost:8080"]';
var suggestions = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: URL_ROOT + '/api/suggestions?querytext=%QUERY'
});
suggestions.initialize();
$(document).ready(function() {
$('input.typeahead').typeahead({
source: suggestions.ttAdapter()
});
});
When the page loads, I do not see any errors in the console window. As I type though, I do not see any requests to the server in Fiddler. I would expect as I typed to see requests being made to the server to find suggestions. What am I doing wrong?