Rails Ajax questions

Hi,
So I have a controller action that populated an instance variable
@links. The Links are rendered as partials and displayed down the
page in a div. What I want to do is: on clicking a link (from a
dropdown menu) go to that same action, repopulate @links and replace
the content in the page div with the new content. Is this a
link_to_remote with an :update option, an rjs template with
replace_html or something else? Thanks for you help.

JB

This would be a select which has an observer on it.

Julian

If you look at rjs, you can do a page.replace_html div,
render :partial => ‘partial’

You can call this from a link_to_remote, have the controller
repopulate the @links and let rjs do the trick.

You could also do it in the controller to replace the html like so:

if request.xhr?
render :update do |page|
page.replace_html div, :partial => ‘partial’
end
end

Serge