Quite frequently when building AJAX applications, you will need your client script to retrieve data from the server at regular intervals. There are numerous example scenarios, and you will meet many in this book, and perhaps many more in your real-world projects.
clearInterval, which can be used like this:
// using setTimeout and clearTimeout timerId = window.setTimeout(“function()”, interval_in_milliseconds); window.clearTimeout(timeId); // using setInterval and clearInterval timerId = window.setInterval(“function()”, interval_in_milliseconds); window.clearInterval(timeId);
setTimeout causes the function to be executed once, after the specified time period.
executes the function repeatedly, at the mentioned interval, until
is used. In most AJAX scenarios we prefer using...