Autocompletion is working as expected on my form field using drupal_json_output($matches);
Now I'm trying to acces this data with the following code in my module js file:
(function($) {
$(document).ready(function() {
// this works
$( "#autocomplete_field" ).autocomplete({
change: function( event, ui ) {
console.log('Change works.');
}
});
// get data
$("#autocomplete_field").result(function (event, data, formatted) {
console.log(data);
});
});
}(jQuery));
but it's not giving any data. I am getting "TypeError: this.source is not a function". The change function does work.
How do I access this data in my modules js file?
Thanks for any help in advance.