Created
August 4, 2012 22:23
-
-
Save cmarkle27/3260350 to your computer and use it in GitHub Desktop.
jQuery Ajax using when
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
function doAjax(){ | |
return $.get('/echo/html/'); | |
} | |
function doMoreAjax(){ | |
return $.get('/echo/html/'); | |
} | |
$.when( doAjax(), doMoreAjax() ) | |
.then(function(){ | |
console.log( 'I fire once BOTH ajax requests have completed!' ); | |
}) | |
.fail(function(){ | |
console.log( 'I fire if one or more requests failed.' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment