Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.