title: Success and error callbacks in model.save() are random/asynchronous
body: <p>I know there are many questions already present on this topic, but none of the answers have worked for me yet. Please be a bit patient and have a look at my scenario.</p>
  
  <p>I'm saving my backbone model using backbone's <code>model.save()</code> function on click event of a button.</p>
  
  <p>My objective is to perform certain operation based on the response returned, once the model is saved successfully, like so:</p>
  
  <pre><code>SaveActivity: function( e ) 
  {
      this.model.set({'value': 0});
  
      this.model.save(null, /* or {} - no difference with any of the two*/
      {
        success: function (model, response) 
        {
          var id = null;
          var stringed = JSON.stringify(model);
              /*   perform operation with stringed  */
        },
        error: function (model, response) 
        {
          //i am in error
        }
      });
     alert("Done");   //This is the alert mentioned below
  }
  </code></pre>
  
  <p>I see a very weird behavior of the callback functions in this code. If I remove alert, then the error callback is fired (always). On the other hand, with this alert, what happens is - as soon as the button is clicked, "POST" request is fired for the model to be saved and then the alert is popped, irrespective of the fact that "save" is to be completed.</p>
  
  <p>Now comes the catch - If I select "OK" on the alert box, before I have received a "200 OK" http response for the post request (verified through console again), then the error callback is fired. If I wait for "200 OK" to come for POST before selecting the alert box, then success callback is fired. But the problem is, the model is getting saved in both the cases - whether I wait for 200 OK http response to come for POST or not. Also, the POST request takes a few seconds in returning the success response.</p>
  
  <p>I realize that this is because of the asynchronous behavior of the <code>save()</code> function. But I have tried many things and still problem persists. Any help in this would be really appreciated.</p>
  
  <p>Thanks!!!</p>
  
  <p>Here is the original code for this function</p>
  
  <pre><code>SaveDraftActivity: function( e ) 
  {
      if (CKEDITOR.instances['editor1'].getData() == '')
      {
          alert('Activity Content cannot be left blank. Please fill the content before saving.'); 
          return false;
      }
      else
      {
           this.model.set({'publishStatus' : 0});
  
           this.model.save({}, 
           {
                  success: function (model, response) 
                  {
                      var id = null;
                      var stringed = JSON.stringify(model);
                      console.log("in success ");
                      var words = stringed.split(",");
                      for (var i=0; i&lt;words.length; i++)
                      {
                          if (words[i].indexOf('tenantActivityId') != -1)
                          {
                              j = words[i].indexOf(":");
                              j+=2;
                              id = words[i].substring(j, words[i].length-1);
                              //break;
                          }
                      }
                      var tenantActivityId = id;
  
                      if (tenantActivityId != "")
                          document.getElementById("formAttachment").submit();    //Another POST Request
                      else
                           document.getElementById("RedirectForm").submit();    //Another POST Request
                  },
                  error: function (model, response) 
                  {
                      console.log("in error ");
                  }
           });
      }
      alert("Activity is successfully saved.");           
  },
  </code></pre>