我正在尝试在不刷新的情况下进行页面更新,并且我已经阅读了一些教程并提出了以下代码。但是,它似乎不起作用。当您按下按钮时,似乎什么也没有发生。
index.php 代码
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script>
function updateShouts()
{
$('#refresh').load('update.php');
alert('it works!'); uncomment this to know if your script works
}
</script>
</head>
<body>
<div id="refresh">
<?php
include('update.php');
?>
<button onclick="updateShouts()">Try it</button>
</div>
</body>
</html>
update.php 代码
<?php
print strftime('%c');
?>