title: Rails ajax with POST function: why template missing?
body: <p>I'm completing an avatar upload and crop using ajax submit.</p>
  
  <p>I'm sending via ajax the base64 image and then I convert my image for carrierwave.</p>
  
  <p>Everything works fine, except for the ajax response: Template missing.</p>
  
  <p>This is my ajax call:</p>
  
  <pre><code>$.ajax({
    type: "post",
    dataType: "json",
    url: "/profile/update_avatar",
    data: { image: canvas.toDataURL() }
  })
  .done(function(data) {
  
    // You can pull the image URL using data.url, e.g.:
    $('.user-image').html('&lt;img src="'+data.url+'" /&gt;');
  
  });
  </code></pre>
  
  <p>And this is my controller:</p>
  
  <pre><code>def update_avatar
  respond_to do |format|
    if current_user.update_cropped_avatar(params[:image])
      format.js
      format.html { render :nothing =&gt; true, :notice =&gt; 'Update SUCCESSFUL!' }
    else
      format.html { render :action =&gt; "edit" }
      format.json { render :json =&gt; current_user.errors, :status =&gt; :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>end</p>
  
  <p>I don't need to render template... but the error is:</p>
  
  <pre><code>Missing template profiles/update_avatar, application/update_avatar with {:locale=&gt;[:it], :formats=&gt;[:js, :html], :handlers=&gt;[:erb, :builder, :raw, :ruby, :coffee, :haml]}. 
  </code></pre>
  
  <p>Why?</p>