Rails - ajax page partial update <p>I have my home.html.haml page rendering 3 partials:</p> <pre><code>%h1 Foo #foo1 = render partial: 'foo/foo', locals: {items: @foo1_items} #foo2 = render partial: 'foo/foo', locals: {items: @foo2_items} #foo3 = render partial: 'foo/foo', locals: {items: @foo3_items} </code></pre> <p>Currently, I have some remote links that refresh these parts individually firing an ajax call to to the home page:</p> <pre><code>= link_to 'refresh', home_path(mode: 'foo1'), remote:true = link_to 'refresh', home_path(mode: 'foo2'), remote:true = link_to 'refresh', home_path(mode: 'foo3'), remote:true </code></pre> <p>and I have a <strong>home.js.erb</strong> that contains something like this:</p> <pre><code>&lt;% if params[:mode] == 'foo1'%&gt; $('#foo1').html('&lt;%= j(render partial: 'foo/foo', locals: {items: @foo1_items}) %&gt;') &lt;% elsif params[:mode] == 'foo2'%&gt; $('#foo2').html('&lt;%= j(render partial: 'foo/foo', locals: {items: @foo2_items}) %&gt;') &lt;% else %&gt; $('#foo3').html('&lt;%= j(render partial: 'foo/foo', locals: {items: @foo3_items}) %&gt;') &lt;% end %&gt; </code></pre> <p>I am wondering:</p> <ol> <li>if this is the default(suggested, best) Rails way to do a partial page refresh or generally the way to handle ajax requests?</li> <li>if it would be faster to have server respond with pure html and let the client (javascript) to do the replacing?</li> <li>how do you handle this in your application?</li> </ol>