Basically what I'm trying to achieve is to load data (from a database) from jQuery with an Ajax call. The Ajax call communicates to a script to load and return the data in JSON format back to jQuery. I then want to use this data for typeahead.js. I've read this thread and used the following code:
$('.subject').typeahead({
source: function(query, process) {
return $.get(
'/get/subjects',
'uni=' + query,
function(data) {
return process(data);
}
);
}
});
The page /get/subjects
returns JSON, however the typeahead proceeds to not work, with no error. However, it does alter the layout of my page, but no result!
Thanks