Refresh WebPage periodically

旧城冷巷雨未停 提交于 2019-12-23 12:29:01

问题


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 ?


回答1:


Maybe you can try the setTimeout javascript method

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

this would refresh the page on every timeoutPeriod interval.




回答2:


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


来源:https://stackoverflow.com/questions/10944297/refresh-webpage-periodically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!