I have following code:
var aReq = $.getJSON('/path/A'),
bReq = $.getJSON('/path/B');
$.when(aReq, bReq).then(function(A, B) {
console.log(A, B);
// logs: [Array[5], "success", Object], [Array[20], "success", Object]
});
Why is this wrapped in a "jqXHR array"?
With a single $.getJSON
this doesn't happen:
var aReq = $.getJSON('/path/A');
$.when(aReq).then(function(A) {
console.log(A);
// logs: [Object, Object, Object, Object, Object]
// just like I wanted it in the first version
});
Is there a way to accomplish that the first version works? Maybe I understood something wrong with promises/deferred objects.
FWIW: I am using jQuery version 1.7.1 in this case.