Shandy Nantz wrote:
I would like to use the link_to_remote method in my controller so I can
update a list within my .rhtml file without having to re-load the entire
page. Basically, what I am doing is adding stuff to a list and then
allowing that stuff to be deleted from the list if the user so chooses -
all with the built-in AJAX functionality. The idea is that I do not want
the entire page to re-load. I'm thinking that there is an eval() method
that I can use but have not yet discovered it. Anyone have any ideas?
Put the snip of rHTML that needs to refresh into a partial. Include it the normal way, like this:
<%= render :partial => 'my_partial' %>
Now wire link_to_remote up to an action that looks like this:
return unless request.xhr?
render :update do |page| # <-- I call that rjs sometimes!
page.replace_html 'refresh_me', :partial => 'my_partial'
(Question for the lifers - is it _really_ "almost anything"? Or is it "anything"!?)