title: What to return from ASP.NET MVC action to allow jQuery ajax success event to fire?
body: <p>Right now my ajax posts all fire their Error events even if the action did not cause an error.  I have an ASP.NET MVC action that looks like:</p>
  
  <pre><code>[AcceptVerbs(HttpVerbs.Post)]
  public virtual ActionResult StuffToDo(int id)
  {
       // do various things that work ...
       return new JsonResult(); // i have to return something, so this...
  }
  </code></pre>
  
  <p>On the client side I have this jQuery:</p>
  
  <pre><code>$('#actionClick').click(function() {
       if (confirm('Are you sure?')) {
           $.ajax({
               type: "POST",
               url: "/Customer/StuffToDo/&lt;%= Model.Customer.Id %&gt;",
               contentType: "application/json; charset=utf-8",
               data: "{}",
               dataType: "json",
               success: function() {
                   ShowSuccessResult("Yay!");
               },
               error: function(xhr, ajaxOptions, thrownError) {
                   ShowErrorResult("Boo! Message:" + xhr.responseText);
               }
           });
        }
        return false;
   });
  </code></pre>
  
  <p>If the action is successful (no exceptions thrown) then I would expect the success event handler to be triggered.  Instead the error event is firing.  Is there something I should pass back or change in the action so the success event fires?</p>
  
  <p>I realize this question is basically the same as <a href="https://stackoverflow.com/questions/1080858/how-to-return-bool-from-msft-mvc-action-to-jquery-ajax">this other question</a>, but my error handler already has the expanded signature which solved the other person's question.</p>
  
  <p>I changed the return value to Null to see if that affected anything, but no behavior change.</p>
  
  <p>Its starting to look like this is an issue with HTTPS.  I get multiple responses from the request.  The first 2 are 401 messages and then I get a 200.</p>