AJAX定时请求数据

$(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('出错
'+xhr.responseText)}
    });
     
    };
    run();
    });
原文地址:https://www.cnblogs.com/lampon/p/3184987.html