Remote content


I’ve looked through the api and I can’t seem to find the functionality
that I’m looking for. I want a link that, when clicked, will replace
content of a div with the rendered content of another action. Something
like what you can accomplish when you use remote_form_tag and then have
the reply replace the content of a div in the page. I’m sure this must
possible from a link, but I can’t seem to figure out what to do.


David M wrote:


Rails mailing list
[email protected]

You could use link_to_remote to call an action that renders the content
you want to fill the div with. You could do this by setting
:update=>“some_div_name” or by leaving out update and by using an rjs
file with the name of the action that the link_to_remote calls.


link_to_remote “Change Content”,
:url => { :action => “change_content”},
:update => “mydiv”


link_to_remote “Change Content”, :url=> { :action => “change_content”}
and then have a .rjs file named change_content.rjs with contents
page.replace_html “mydiv”, :partial =>

Good Luck,
Matthew M.

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