I have a variable number of URL's that I want to make $.ajax(urlx)
to and I don't see any examples of how to pass that to $.when
. It does not look like .when takes an array, just a list of parameters.
How can I make this work?
var picturesArray = [];
var urlCount = 2;
$.when(
$.ajax(urls[0]),
$.ajax(urls[1])
).done(function() {
var cntx;
for (cntx = 0; cntx < urlCount; cntx++) {
picturesArray.push(arguments[cntx][0]);
}
});