Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
For example, like this (by calling subqueries in parallel):
$.get( "https://swapi.co/api/people", function( people ) {
var deferredSubRequests = [];
$.each(people.results, function( i, person ) {
console.log(i, person.name);
deferredSubRequests.push($.get(person.homeworld));
});
$.when(deferredSubRequests).then(function(results) {
console.log('DONE!');
$.each(results, function( j, planetResult ) {
//var ss = result.promise.resolve();
planetResult.done(function(planet){console.log(j, planet.name);});
});
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question