【发布时间】:2014-04-30 21:25:36
【问题描述】:
我有这个 JQuery 代码,它每 X 秒将一个 php 文件加载到一个 div 中
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh
setInterval(function() {
$('.container').load('dashboard.php');
}, 10000); // the "3000" here refers to the time to refresh the div. it is in milliseconds.
});
// ]]></script>
<div class="container"><h3>Loading Dashboard...</h3></div>
当加载开始时,它会显示 Loading Dashboard 文本,但每隔 X 秒它只会刷新背景中的内容。每次刷新时如何显示某种加载图像?
【问题讨论】:
-
使用加载指示器作为容器的背景,然后将其隐藏在
load回调中。
标签: javascript jquery html