我试图刷新一堆div中的某个div.除了在XMLHttpRequest的帮助下发送的许多变量之外,div内容基本上由PHP以及来自MySQL数据库的数据生成.
我的想法是重新加载/刷新div本身而不是加载php文件或用.text或.html覆盖它.在这种情况下,我不能使用.load(‘file.php’)
我尝试过的:
function updateDiv()
{
document.getElementById("here").innerHTML = document.getElementById("here").innerHTML ;
}
和(每3秒刷新一次):
$(document).ready(function () {
setInterval(function () {
$('#here').load('#here'));
}, 3000);
});
理想情况下,我会要求:
function reloadDIV () {document.getElementById("here").innerHTML.reload}
function reloadDIV () {$('#here').load(self)}
这样我就可以在onClick中使用它:
reload div