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

Popular Tags

Recent Comments

  • Wed Nov 19 by xxxRAWxxx

    There’s a new one for you. Can’t believe I stumbled ...

  • Wed Nov 19 by Chris

    @Ryan, @Nick – well, I’m glad I’ve been of help, ...

  • Tue Nov 18 by Ryan

    Ha! Yeah, it is a little awkward. Good thing I don’t actually...

  • Tue Nov 18 by Chris

    While your explanation is sound, I cannot bear the hear the audible...

  • Tue Nov 18 by Ryan

    I suggest looking into unobtrusive javascript, especially since you...

  • Tue Nov 18 by Nick

    Update – I found out that my inclusion of jQuery was causing ...

  • Tue Nov 18 by Nick

    I had something about 20% developed in PHP and got sick of it. It&#...

Flickr Photos

  • Desolate
  • Along the fence
  • Blurred
  • Darting
  • One rose left
  • Farm entry
  • Watch your step
  • Back to work

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

Get in Touch