application-wide ajax indicator 09 Jun 2009
Tags: ajax

If you don't want to worry about ajax indicators whenever you fire an ajax request, add this in your application.js. As for indicator gifs, go to ajaxload.info to create one that best suit your site.

javascript
Ajax.Responders.register({
  onCreate: function() {
    if (Ajax.activeRequestCount > 0) Element.show('spinner');
  },
  onComplete: function() {
    if (Ajax.activeRequestCount == 0) Element.hide('spinner');
  }
});