Display 'loading' icon for all ajax requests


/ Published in: Rails
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.