link_to_remote clicking a link should replace that link


I haven't touched Ruby for a while. How do you replace link_to_remote text after user clicks on them? Once a user clicks 'Delete this post,' I want the text gets replaced to 'pending request' -- is there any easy way to do this?

You'll need a smidgen of javascript for this. if blah where the dom id of the link, $('blah').update 'pending request' might be enough or you might want to actually replace the link rather than just change it's text. The prototype api ( Prototype API Documentation | Home (Deprecated URL) ) has details on both (obviously if you're using a different js library, read that api).

Depending on your app you might want to do with when the request is started rather than when the request completes; one of the other options like :before might be appropriate.