JS 定时器,定时调用PHP

$(function() {
     var voiceplay=function(){
         var site = location.href.split('_cms')[0] + '_cms/';
         $.ajax({ 
             url: site + 'main_equipment/getMainEquipmentStatus', 
             method:'get', 
             success: function (data) {
                    console.log(data);return;
                }, 
                complete: function (XHR, TS) { 
                    XHR = null;
                } 
            })
        }
        //定时器,定时加载
        setInterval(voiceplay,3000);
    })

关注微信公众号:lovephp

posted @ 2018-11-15 09:49  梦想_行人  阅读(604)  评论(0编辑  收藏  举报