Home > Article > Web Front-end > JS implements scheduled tasks, requesting background setInterval timing and ajax requests every N seconds
DiGui = function (param) {
$.ajax({
success: function (returnValue) {
window.setInterval("fnSetMarkPoint()", 5000);
}
});
After calling the DiGui() method
Problem: Create a setInterval every 0.1 seconds in a tree shape Create setInterval in a loop until the page crashes
Solution: Ensure that the setInterval object is only created once
Implementation plan: Define a Boolean variable for judgment var status= true;
status = = .: = .setInterval("()", 5000
The above is the detailed content of JS implements scheduled tasks, requesting background setInterval timing and ajax requests every N seconds. For more information, please follow other related articles on the PHP Chinese website!