Link_to_remote method display a loading image?

Hey guys,

what would be the best way to incorporate this into the builtin
link_to_remote() method?

document.getElementById(‘main’).innerHTML = ‘’;

Id like for the item above to take place while the page is loading.
I’m currently doing this with another javascript but would prefer to
use rails. Unfortunately, rails just sits there until the page loads.

Thank you

i believe link_to_remote takes a :before and :after option which you can
pass js to execute.

mark

I ended up adding a loading() function within prototype.js with this:
javascript:document.getElementById(‘sleep3’).innerHTML = ‘’;

and adding this to the rhtml:

<%= link_to_remote(“Sleep 3”, :url => “/templates/sleep3”, :update =>
“test_div_01”, :loading => “loading(‘test_div_01’)” ) %>

works for me! :slight_smile: thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs