How to automatically refresh the page:
1. <% response. setHeader ("Refresh", "3"); %> // 3 seconds
2.
Add this codeOrRegion
20 indicates refreshing the page every 20 seconds.
3
Automatic page Jump: add this codeOrRegion
20 means jump to the http://www.baidu.com page every 20 seconds
4. Automatically refresh js edition on the page
<Script language = "JavaScript">
Function myrefresh ()
{
Window. location. reload ();
}
SetTimeout ('myrefresh () ', 1000); // refresh once per second
</Script>
In the above 4, the method page refresh will flash... It is not recommended because it does not feel good.
It is best to use Asynchronous refresh .....
// Refresh the page in one minute
Function res (param ){
$. Ajax ({
Url: 'lastAuctionItem.html ',
Data: {aItemId: param },
Success: function (data ){
If (data. data. id> 0 ){
If (data. data. lastBid> 0 ){
Var price = parseInt (data. data. lastBid) + parseInt (data. data. increment );
$ ("# Bids" pai.html ("");
} Else {
Var price2 = parseInt (data. data. initialPrice) + parseInt (data. data. increment)
$ ("# Bids" pai.html ("");
}
}
If (data. error = "error "){
Return false;
}
}
});
}
// Refresh the page in one minute. Baidu checks the setInterval usage method. Specifically, the setInterval method is executed when the page is loaded ..
In the following example, this method calls the res function every minute... Res does not jump to the page after the page is submitted asynchronously for partial refresh.
SetInterval ("res ('$ {auctionItem. id}');", 1000*60 );