// 新訂單提醒 function hello() { $.ajax({ url:'checkOrderNum', type:'get', success:function (result) { console.log(result); if (result == 1){ // 右下角彈框 layer.open({ type:0, title: '提示', content: '您有新的訂單,請及時查看', anim: 2, shade:0, offset:"rb" }); } } }); $.ajax({ url:'checkSpeedOrderNum', type:'get', success:function (result) { console.log(result); if (result == 1){ // 右下角彈框 layer.open({ type:0, title: '提示', content: '您有新的快速測試訂單,請及時查看', anim: 2, shade:0, offset:"rb" }); } } }); } setInterval("hello()",10000);
http://www.runoob.com/jsref/met-win-setinterval.html
使用setInterval()方法