Is there a way to get a link to a partial to open in a div, which I
can open with
the prototype .toggle() ?
What I want is to put a link on a page, which, when clicked, renders
the partial in a div in that page. However, I dont want the partial
merely sitting, already rendered in a hidden div, but rather, to be
called and rendered when the link is hit (i.e. minimal transmission to
the client) Is there a way I can do this? Thanks, RVince
You can’t do both of these things at the same time.
If you want to use toggle, the content should already be there and may
If you want to generate the content when the link is clicked, then you
should use link_to_remote to render the link,
Then you can render a partial in your rjs template have something like
page.replace_html, :partial => ‘example’
Yes, link_to_remote will call some action in your controller. That
That controller can have an some-action.rjs template (instead of the
That template could look something like this:
page.replace_html ‘id-of-some-element-on-your-page’, :partial =>
‘partial you want to render there’
You could also render it directly in your controller if you prefer.