JS implementation of AJAX requests every 5 minutes _javascript tips

Source: Internet
Author: User
A page seems to have only one window.onload=function () {}, so there are multiple events, so it's good to write.
Copy Code code as follows:

Window.onload=function () {
Let's say we run the test function every five minutes.
Publicbusi ();
Personbusi ();
}
function Publicbusi () {
settimeout (PERSONBUSI,1000*60*7)//Here 1000 means 1 seconds with 1000 milliseconds, 1 minutes 60 seconds, 7 for a total of 7 minutes
$.post (' ${basepath}/approval/tocheckpublicbusi ', function (data) {
if (Data.result!=0) {
....................
}
});
}
function Personbusi () {
settimeout (publicbusi,1000*60*5)//Here 1000 means 1 seconds with 1000 milliseconds, 1 minutes 60 seconds, 5 for a total of 5 minutes
$.post (' ${basepath}/approval/tocheckpersonbusi ', function (data) {
if (Data.result!=0) {
............
}
});
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.