ivirabyan / jquery-mentions

Adds mentioning support to your text fields.
http://ivirabyan.github.io/jquery-mentions/
MIT License
114 stars 49 forks source link

Callback at every start and end of JSON request? #38

Closed nlsrchtr closed 9 years ago

nlsrchtr commented 9 years ago

I would like to be able to show a loading indicator if the jquery-mentions starts to send an external query. I was trying to use the autocomplete syntax like

$('textarea.mentions').mentionsInput({
  source: '/search.json',
  response: function( event, ui ) {
    console.log('test');
  }
});

but I had no luck with it. Is there any solution to this problem? Would be great.

nlsrchtr commented 9 years ago

Thanks for this really quick response! Great work! For everybody with the same need, feel free to use and change the following usage-example accordingly:

$('textarea.mentions').mentionsInput({
  source: '/search',
  autocomplete: {
    search: function(event, ui) { $('#mentions-loading-animation').removeClass('hide'); },
    close: function(event, ui) { $('#mentions-loading-animation').addClass('hide'); }
  }
});