[Solved] Using jQuery deferred and promise inside loop

I think you can do something as simple as this: var sortedArray = [AList, BList, CList, DList]; Promise.all(sortedArray.map(function(value) { var url = …; return getListItems(url); })).then(function(results) { // results is an array of results from AList, BList, CList, DList in order let allJsonData = []; results.forEach(function(approvedListItems) { allJsonData.push.apply(allJsonData, approvedListItems.d.results); }); // process allJsonData here }); … Read more