Last active
December 28, 2015 20:44
-
-
Save terrymun/ca95de155b7cbd892769 to your computer and use it in GitHub Desktop.
Better $.ajax() requests — multiple AJAX response evaluation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a1 = $.ajax({...}), | |
a2 = $.ajax({...}); | |
$.when(a1, a2).done(function(r1, r2) { | |
// Each returned resolve has the following structure: | |
// [data, textStatus, jqXHR] | |
// e.g. To access returned data, access the array at index 0 | |
console.log(r1[0]); | |
console.log(r2[0]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment