function Yourfunction() { $.post("test", function() { alert("success"); }).complete(function() { //完成后操作 }); } setInterval(Yourfunction, 5000);