Use Ajax to regularly refresh Page code without blinking, and use ajax to refresh the page
In Web development, we often need to regularly refresh a page:
1. To keep the session value or check whether the session value is null (for example, to prevent repeated login by the same user );
2. implement real-time intra-site SMS;
3. Regularly update page data. However, you may find many ways to regularly refresh the page. The simplest method is to add the following code between the
Code is added between the
<Meta http-equiv = "refresh" content = "5" URL = "Example. aspx"/>
Note: The content value indicates the page refresh interval, in seconds.
URL value specifies the page to be refreshed
Another method is to use JavaScript to regularly refresh the page.
Regularly refresh the page with JavaScript. I have not tested this code.
<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> It is added to the center of the body. The value 0: 10 is 10 seconds. It can be customized.
The above is the example code for refreshing the page without flashing the Ajax implementation introduced by xiaobian. I hope it will be helpful to you. If you want more information, please stay tuned to the help House website!