$(function(){ var time=500; var interval; function run(){ interval=setInterval(fun,time); } function fun(){ $.ajax( { //alert(); type : 'post', dataType : 'text', url : 'mynews!query', success : function(data) { alert(); },error:function(xhr){alert('出错\n'+xhr.responseText)} }); }; run(); });