Add a loading image for all ajax requests

Do you get tired of passing the :loading and :complete options to your link_to_remote’s? Me too. I usually keep some sort of ‘loading’ .gif in my layout somewhere, and set it to show/hide on each ajax call. I stumbled upon a solution using event:Selectors the other day, and it worked like a charm. You may be able to register ajax responders directly in your prototype.js file, but from past experience I’ve found eventselectors.js to be useful, so having it handy isn’t so bad.

Comments

Have something to say?
Please rewrite the image text Are You Human? Hint: Are You Human? Formatting Tips

or

© 2009 Ryan Heath | Site Management A Ruby on Rails production.

Get in Touch