I have the following code:
var requests = [];
var files = ['one.html', 'two.html', 'three.html'];
for(var i = 0; i<files.length; i++){
requests.push($.get(files[i]));
}
$.when.apply(undefined, requests).
then(function(resultOne, resultTwo, resultThree){
console.log(resultOne[0]);
})
I wish to avoid having to define variable for each response in the .then and instead retrieve an array of responses.
How should I go about this?
Thank you!