JSFiddle - React, Tailwind, and code Playground
by GregWoods
JavaScript
var promises = [];
function doThreeThings() {
promises = [];
for (var n = 0; n < 3; n++) {
promises.push(doOneThing(n));
}
jQuery.when.apply(jQuery, promises).always(function () {
alert('all three done!');
});
}
function doOneThing(n) {
alert('one done');
return jQuery.get("http://fiddle.jshell.net/xxxx" + n + ".html").promise();
}
doThreeThings();