title: Handling json response from update in Rails 3
body: <p>I'm just trying to understand just the basic response here.  I have an unedited controller method</p>
  
  <pre><code>  def update
      @ledgeritem = Ledgeritem.find(params[:id])
  
      respond_to do |format|
        if @ledgeritem.update_attributes(params[:ledgeritem])
          format.html { redirect_to @ledgeritem, :notice =&gt; 'Ledgeritem was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render :action =&gt; "edit" }
          format.json { render :json =&gt; @ledgeritem.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>And my ajax</p>
  
  <pre><code>$.ajax({
      type: "PUT",
      url: "/ledgeritems/" + id + ".json",
      data: $(this).serialize(),
      dataType: "json",
      success: function (result) {
          alert(result);
      }
  });
  </code></pre>
  
  <p>My alert never shows, but the item does update.  What's the correct way to read and handle the json response?  I know this is a basic question, but I can't find any examples or information on this.</p>