0
嗨我一直在使用Auto-refreshing div with jQuery - setTimeout or another method?中提出的建议刷新一个div。该div是刷新一个PHP脚本,在后台计算大量的数字。停止JQuery刷新DIV
有没有人知道我可以停止DIV刷新一旦在PHP脚本中的计算已完成加载?
嗨我一直在使用Auto-refreshing div with jQuery - setTimeout or another method?中提出的建议刷新一个div。该div是刷新一个PHP脚本,在后台计算大量的数字。停止JQuery刷新DIV
有没有人知道我可以停止DIV刷新一旦在PHP脚本中的计算已完成加载?
您可以使用简单的布尔值或只是一个if语句。
finished = false;
function update()
{
if (finished)
return;
else
{
// continue calculating and call again
window.setTimeout(update, 10000);
}
}
假设您的计时器名为timer
,您可以调用以下命令来取消刷新div的计时器。
clearTimeout(timer);