I have the following code in place to initialize typeahead using version 2.3.0:
jQuery('#search_terms').typeahead({
source: function(query, process) {
return jQuery.ajax({
url: '/api/path',
type: 'GET',
data: {q: query},
dataType: 'json',
success: function (json) {
return process(json.suggestion);
}
});
}
});
I've verified that typeahead works by substituting static data. I've seen that json.suggestion evaluates to a single word as expected. The ajax response itself looks like this:
{"suggestion":"word"}
However, Bootstrap refuses to load the response into typeahead. What am I missing? I admit that I'm having trouble finding detailed documentation of Bootstrap Typeahead via ajax other than here on SO.
Thanks in advance.