What is the best way to update more that 1 div in AJAX call

I want to update more than 1 div inside the page with 1 AJAX call.
I noticed you can only render 1 at a time in Rails methods and also you
can only set 1 update: inside form_remote_for.

What is the best way to update more than once?

Look into update_page and the methods you can put inside it's block (particular replace_html). In the form_remote_for/link_to_remote case you don't specify the :update parameter. Let the RJS that gets returned do your bidding. You're still only rendering one thing, but that render is a bunch of JS that does what you want...


Yields a JavaScriptGenerator and returns the generated JavaScript code. Use this to update multiple elements on a page in an Ajax response. See JavaScriptGenerator for more information.


   update_page do |page|
     page.hide 'spinner'
     # and other things....