Home > Web Front-end > JS Tutorial > Implementation method of js executing ajax request every 5 minutes_javascript skills

Implementation method of js executing ajax request every 5 minutes_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:12:05
Original
1729 people have browsed it

It seems that a page can only have one window.onload=function(){}, so there must be multiple events, just write it like this

Copy code The code is as follows:

window.onload=function(){
//Assume that the test function is executed every five minutes
publicBusi();
personBusi();
}
function publicBusi(){
setTimeout(personBusi,1000*60*7);//1000 here means there are 1000 milliseconds in one second, 60 seconds in one minute, and 7 means 7 minutes in total
$.post('${basePath}/approval/toCheckPublicBusi',function(data){
if(data.result !=0){
........... ............
}
});
}
function personBusi(){
setTimeout(publicBusi,1000*60*5);// The 1000 here means there are 1000 milliseconds in 1 second, 60 seconds in 1 minute, and 5 means 5 minutes in total
$.post('${basePath}/approval/toCheckPersonBusi',function(data){
if(data .result !=0){
............
}
});
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template