Home >Web Front-end >JS Tutorial >Ajax implementation of flicker-free scheduled refresh page example code
This article mainly introduces the example code of using Ajax technology to achieve flicker-free scheduled page refresh. It is very good and has the value of reference and learning ajax. Friends who are interested in ajax should read it together
In web development, we often need to refresh a page regularly:
1. To maintain the value of session or check whether the value of session is empty. (For example, to prevent the same user from logging in repeatedly);
2. Real-time in-site text messages;
3. Regularly update page data, etc. However, when we search on the Internet, we will find that there are many ways to refresh the page regularly. The simplest is to add the following code between the 93f0f5c25f18dab9d176bd4f6de5d30e9c3bca370b5104690d9ef395f2c5f8d1 tags:
in 68754200080df2529cd354a1f1e1f11e9c3bca370b5104690d9ef395f2c5f8d1 tags to achieve regular refresh. I have tested this code and it can achieve the effect
397e927abd042d45544481dc332c0461
Description: The value of content represents the interval between page refreshes, in seconds.
The value of URL specifies the page to be refreshed
Another way is to use JavaScript to refresh the page regularly
JavaScript to refresh the page regularly, I don’t have this code After testing
<script> var limit=":" if (document.images){ var parselimit=limit.split(":"); parselimit=parselimit[]*+parselimit[]*; } function beginrefresh(){ if (!document.images) return; if (parselimit==) window.location.reload(); else{ parselimit-=; curmin=Math.floor(parselimit/); cursec=parselimit%; if (curmin!=) curtime=curmin+" min "+cursec+" sec "; else curtime=cursec+" sec "; window.status=curtime; setTimeout("beginrefresh()",); } } window.onload=beginrefresh; </script>
is added to the middle of the body, here is 0:10 for 10 seconds, you can customize
The above is small The editor introduces to you the example code of Ajax to achieve flicker-free scheduled page refresh. I hope it will be helpful to you! !
Related recommendations:
Solution to Ajax rollback refresh page problem
Ajax submission Form form page will still refresh j solution
The above is the detailed content of Ajax implementation of flicker-free scheduled refresh page example code. For more information, please follow other related articles on the PHP Chinese website!