Is there a place I can find more information about jquery's when function? Basically, what I do is (pseudo-code)
$.when(ajaxCall1, ajaxCall2)).done(function(data1, data2) {
console.log(data1);
console.log(data2);
// do something real with the data
});
so what I don't get is, in my ajaxCall1, I used to do something like this when it was a standalone function and not in jquery's when():
$.ajax({
url: '/api/platform/' + platform,
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function (data) {
console.log("Got data");
self.platforms = data;
self.eventAggregator.trigger('getplatforms');
},
});
So the data parameter in that function looks different than what the $.when() returns. It looks like $.when returns an array by logging it. So I'm blindly going
self.platforms = data[0];
So is there more documentation on the subject somewhere? I don't feel comfortable blindly getting the first parameter of the array without knowing what it is, and I don't know what to do if there is an error in the call.
My ajaxCall1 methods basically just return the $.ajax call.
i.e.
ajaxCall1() {
return $.ajax....
}