Cygnus
Cygnus

Reputation: 3330

Refresh WebPage periodically

My requirement is that i have a .php page that has to display some graphs/data based on data from a database. I would like refresh the page automatically and periodically so that graphs/data can be updated, as the data is obtained only on loading of the page. How can i do this ?

Upvotes: 6

Views: 14365

Answers (2)

KiiroSora09
KiiroSora09

Reputation: 2287

Maybe you can try the setTimeout javascript method

setTimeout("location.reload(true);",timeoutPeriod);

this would refresh the page on every timeoutPeriod interval.

Upvotes: 10

Alpesh Prajapati
Alpesh Prajapati

Reputation: 1653

You can use javascript.

JS function

function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}

Add below line on body tag.

 <body onload="JavaScript:timedRefresh(5000);"> // time : 5000= 5 secs

Upvotes: 8

Related Questions