I've written this code in order to fetch items from multiple url's . I want to know when all of the $.get
calls have been satisfied :
foo : function(arrIds){
var arrJqxhr = [];
var arrReturnedData = []
for ( var i = 0, l = arrIds.length; i < l; i++ ) {
var url = '/thing/' + arrIds[i].toString()
arrJqxhr[i] = $.get(url)
.done(function(data, textStatus, jqXHR) {
arrReturnedData.push(data);
})
}
Apart from keeping count of how many times the .done
has been called is there any better way ?