Wait for multiple getJSON calls to finish
I have a loop that makes calls to an API and compiles the results into an array. How do I wait until all of the calls are finished until resuming execution? I see a bunch of answers for how to wait until one call is done, but I don't understand how to check for all of them. If I make a while loop that waits until 'obj' is the correct length, the page just stalls until the calls are done, which is not what I want. Help please? function getData(id) { var thisI = i; var url = "www.whatever.com?id=" + id; $.getJSON(url, function(data) { obj[thisI]=data; }); } obj = []; for (i=0; i < ids.length; i+