(function poll(){
$.ajax({ url: "server", success: function(data){
// make a sound
if (data.alert) beeboo("WAKE UP!");
}, dataType: "json", complete: poll, timeout: 30000 });
})();
var jqxhr = $.post('/local/upload_parser.php', {parse: JSON.stringify(parse_schedule.slice(0,5))}, function(response) {
console.log(response);
alert( "success" );
})
.done(function() {
alert( "second success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "finished" );
});
// Perform other work here ...
// Set another completion function for the request above
jqxhr.always(function() {
alert( "second finished" );
});
Хотя это и так понятно)