title: rails3 rails.js and jquery catching success and failure of ajax requests
body: <p>Previously, in rails 2.3.8 i used the prototype-helpers <code>link_to_remote</code> and <code>form_remote_for</code> (amongst others). </p>
  
  <p>These had the option <code>:update</code> as follows:</p>
  
  <pre><code>link_to_remote "Add to cart",
    :url =&gt; { :action =&gt; "add", :id =&gt; product.id },
    :update =&gt; { :success =&gt; "cart", :failure =&gt; "error" }
  </code></pre>
  
  <p>(an example from the <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html" rel="noreferrer">documentation</a>).
  This example would, upon success update the html-element with class "cart", and upon failure the class "error".</p>
  
  <p>Now i believe the modus operandi has changed, instead we write:</p>
  
  <pre><code>link_to "Add to cart", :url =&gt; {:action =&gt; "add", :id =&gt; product.id}, 
      :remote =&gt; true
  </code></pre>
  
  <p>and there is no option to set <code>:update</code> anymore.
  Instead of a normal html, we now render javascript, like this (in jquery) :</p>
  
  <pre><code>$('.cart').replaceWith(&lt;%= escape_javascript(render :partial =&gt; 'cart') %&gt;)
  </code></pre>
  
  <p>but how do you handle an error situation?
  Do i handle it in my controller, and use seperate views?</p>
  
  <p>It would seem useful to me to somehow be able to mimic the behaviour we had before. Any ideas?</p>