$ (document). Ready (function() {setinterval ("Startrequest ()", 300 * 1000);//5 minutes Call once }); functionstartrequest () {$.post ("/admin/orderinfo/getmessage",function(data) { if(Data.uroleid = = 3) { if(Data.untreatedsum > 0 | | data.abnormalsum > 0 | | finishorder>0) {alert ("Hello, you have:" + data.untreatedsum + "non-processed orders, and" +data.abnormalsum+ "abnormal orders, and" +data.finishorder+ "the return of the order, please timely processing! "); } } if(Data.uroleid = = 2) { if(Data.nopicksum > 0 | | data.nosendsum > 0 | |data.sendsum) {alert ("Hello, you have:" + data.nopicksum + "does not assign the pickup member's order, and" + Data.nosendsum + "is not assigned to the order of the sender, and" +data.sendsum+ "order is being dispatched, please deal with it in time! "); } } }); }
A simple loop-by-time call method for Js,jquery