jQuery's deferred stuff allows you to chain a .then() onto things like so:
$.ajax({
type: "POST",
url: '/whatever/',
dataType: 'json',
success: function (result) {
alert('fires first assuming a synchronous scenario');
}
}).then(function () {
alert('fires next assuming a synchronous scenario');
});
alert('fires first assuming an asynchronous scenario');
$.ajax({
async: false,
type: "POST",
url: '/whatever/',
dataType: 'json',
success: function (result) {
alert('fires first assuming a synchronous scenario');
}
}).then(function () {
alert('fires next assuming a synchronous scenario');
});
alert('fires first assuming an asynchronous scenario');
No comments:
Post a Comment