Posted By

insanedreamer on 07/28/10


javascript prototype rails3

Versions (?)

Display 'loading' icon for all ajax requests

 / Published in: Rails

Put this in application layout for global use. Have a hidden div called 'loadicon' with a loading icon (or whatever) in it, which is shown/hidden on ajax calls.

  1. -#all purpose display loading icon for ajax calls
  2. :javascript
  3. Ajax.Responders.register( {
  4. onCreate: function() { $('loadicon').show(); },
  5. onComplete: function() { $('loadicon').hide(); }
  6. });

Report this snippet  

You need to login to post a comment.