大家好,我编写了用于跟踪用户点击链接并将它们记录在 php 页面上的代码。这是我的代码
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tracking outgoing links with JavaScript and PHP</title>
</head>
<body>
<p><a href="test2.html">Test link to Google</a></p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>
$(function() {
$('a').click(function() {
$.post("get.php", { name: "John" }
});
});
</script>
</body>
</html>
它正在工作,页面 get.php 已请求但未完成。所以无法保存数据。似乎页面移动得太快了
如何解决这个问题。非常感谢