title: ajax complete callback function is never called
body: <p>I'm using Django.</p>
  
  <p>I have the following code</p>
  
  <pre><code>var done_cancel_order = function(res, status) {
    alert("xpto");
  };
  
  var cancel_order = function() {
    data = {};
    var args = {
      type:"GET",
      url:"/exchange/cancel_order/"+this.id,
      data:data,
      complete:done_cancel_order
    };
    $.ajax(args);
    return false;
  };
  </code></pre>
  
  <p>The function var cancel_order is called when I press a button on the page. That url when accessed is does some things on the server side, which I can check indeed are done, and then returns a json specifying whether or not the request was successful. You get:</p>
  
  <pre><code>{'status':200, 'message':'order canceled'}
  </code></pre>
  
  <p>The problem is that the callback is never called. I would like to have the callback display to the user the thing that was returned from the server. But even the first alert("xpto") inside the callback is never executed. Why is that?</p>
  
  <p>EDIT:</p>
  
  <p>I have checked that this code:</p>
  
  <pre><code>var cancel_order = function() {
    data = {};
    var args = {
      type:"GET",
      url:"/exchange/cancel_order/"+this.id,
      data:data,
      complete: function() { alert("xpto"); }
    };
    $.ajax(args);
    return false;
  </code></pre>
  
  <p>};</p>
  
  <p>displays the same behavior as described above: everything goes great on the server side, but the callback isn't called.</p>