title: Rapid AJAX requests with jQuery results in a SyntaxError
body: <p>I have some ajax requests associated with several elements on my page - when a user clicks 'Attach' or 'Detach', it sends an ajax request to initiate said request.</p>
  
  <p>If the user clicks each item right after another before the previous 'click's AJAX response is received, the following error is received for the requests after the first one:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token d
  </code></pre>
  
  <p>Upon inspection, this occurs at the following:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token d
    $.ajax.success                            addassets.js:217
    f.Callbacks.n                             jquery.js:2
    f.Callbacks.o.fireWith                    jquery.js:2
    w                                         jquery.js:4
    f.support.ajax.f.ajaxTransport.send.d     jquery.js:4
  </code></pre>
  
  <p>Has anyone seen this error/managed to come up with a workaround?</p>
  
  <p>UPDATE:</p>
  
  <p>I re-ran the code, and it appears that it is scrapping the responses to all requests EXCEPT the last one that was submitted. So if a user clicks 1, 2, 3 - the errors will be received for 1 and 2, and the response for 3 will be received as expected.</p>
  
  <p>Here is my ajax code:</p>
  
  <pre><code>    $.ajax({
          url: '/editor/disconnectattachment',
          cache: false,
          data: datastring,
          type: 'POST',
          success: function( data ) {
              console.log( 'received disconnect' );
              var newData = JSON.parse( data );
  
              if ( newData.Message.code != 200 ) {
  
                  var newbutton = '&lt;input type="button" value="Detach File" class="classic detach-attachment" docid="' + docid + '" rel="' + relid + '" /&gt;';
                  $scope.empty().html(newbutton).find('input').uniform();;
  
              } else {
  
                  var newbutton = '&lt;input type="button" value="Attach File" class="attach-attachment" docid="' + docid + '" rel="' + relid + '" /&gt;';
                  $scope.empty().html(newbutton).find('input').uniform();;
  
              }
  
          }
      });
  
  });
  </code></pre>