【发布时间】:2018-02-26 21:14:13
【问题描述】:
我试过这些:
<div id="result">
<table>
<?php require('newses.php'); ?>
</table>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
function autoRefresh_div()
{
$("#result").load("load.html");// a function which will load data from other file after x seconds
}
setInterval('autoRefresh_div()', 1000); // refresh div after 5 secs
</script>
但这对我不起作用。 请访问这些页面:
Reload the content of a div afer regular interval of time
http://devzone.co.in/automatically-refresh-html-page-div-specific-time-interval/
【问题讨论】:
-
您的刷新超时是 1 分钟而不是 5 秒。
-
检查控制台有什么错误。在我这边它正在重新加载
-
@Sand如何设置1秒?
-
@Abhishek 真的有用吗?我真的可以使用客户端脚本重新加载服务器端脚本吗?
-
而不是加载 load.html ,我正在做这种方法并且它的工作正常 "window.location.href =localhost/PhpProject1/chek.php" window.location.reload 刷新浏览器客户端但从服务器获取数据
标签: javascript php html reload ajax-polling