Created
January 19, 2011 00:39
-
-
Save gjohnson/785463 to your computer and use it in GitHub Desktop.
Promise Chaining
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 jxhr = $.ajax('foo.php', { | |
type: 'get', | |
dataType: 'json', | |
success: function (r) { | |
console.log('1'); | |
jxhr.success(function(r){ | |
console.log('4'); | |
}); | |
} | |
}); | |
jxhr.success(function(r){ | |
console.log('2'); | |
}); | |
jxhr.success(function(r){ | |
console.log('3'); | |
if (r[0] === 'one') { | |
jxhr.complete(function(r){ | |
console.log('5'); | |
}); | |
} | |
}); | |
console.log('whats up?'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment