我从一个网站上得到了这个代码,我已经根据我的需要修改了这个代码:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
</head>
<div id="links">
</div>
<script language="javascript" type="text/javascript">
var timeout = setTimeout(reloadChat, 5000);
function reloadChat () {
$('#links').load('test.php #links',function () {
$(this).unwrap();
timeout = setTimeout(reloadChat, 5000);
});
}
</script>
在 test.php 中:
<?php echo 'test'; ?>
所以我希望在链接 div 中每 5 秒调用一次 test.php。我怎样才能正确地做到这一点?