I'm having an issue with my returned data for the chained then being the 1st deferred data. The first example works:
api.getData().done(function(data){
api.getData2().done(
function(data2){
$.log('success', data2);
});
});
But the second example SHOULD work, having data2 for the second .then(), but for some reason its the same as data1.
api.getData().then(function(data1){
return api.getData2();
}).then(
function(data2){
$.log('success', data2);
});
Any suggestions?
api.getData2? If I remember correctly,api.getData2has to return a promise object for this to work correctly, and it also has to resolve the deferred object at some point. I've had this problem before myself.