title: chain callback using deferred and pipe
body: <p>I am struggling to chain the callback with pipes using deferred. It seems to work just fine but in the callback2, it brings me data from callback1. Here is how the code looks like:</p>
  
  <pre><code>var getCall1 = function() {
      return $.ajax(url, {
          type: "GET",
          data: { },
          contentType: "application/json",
          dataType: "json"
      });
  }
  
  
  var getCall2 = function () {
      return $.ajax(url, {
          type: "GET",
          data: {},
          contentType: "application/json",
          dataType: "json"
      });
  }
  
  var callback1 = function (data)
              {
                  alert('call 1 completed');
              };
  
  var callback2 = function (data)
              {
                  alert('call 2 completed');
              };
  
  $.when(getCall1()).done(callBack1).pipe(getCall2()).done(callBack2);
  </code></pre>
  
  <p>What am i missing here?</p>
  
  <p>--Edit--</p>
  
  <p>If i break them in to two deferred calls, it works but then whats the use of chaining and pipe?</p>
  
  <pre><code>$.when(getCall1()).done(callBack1);
  $.when(getCall2()).done(callBack2);
  </code></pre>
  
  <p>--Correct way to do this--</p>
  
  <pre><code>var getCall1 = function() {
      return $.ajax(url, {
          type: "GET",
          data: { },
          contentType: "application/json",
          dataType: "json"
      });
  }.pipe(function (d){return d});
  
  
  var getCall2 = function () {
      return $.ajax(url, {
          type: "GET",
          data: {},
          contentType: "application/json",
          dataType: "json"
      });
  }.pipe(function (d){return d});
  
  var callback1 = function (data)
              {
                  alert('call 1 completed');
              };
  
  var callback2 = function (data)
              {
                  alert('call 2 completed');
              };
  
          $.when(getCall1, getCall2).done(function(d1, d2){
              callback1(d1);
              callback2(d2);
  
          });
  </code></pre>