我有 index.php 它将在移动它时监听鼠标坐标。我想将这些坐标发送到第二个文件(比如 second.php)。为此,我在鼠标移动活动中放置了帖子字段。但我无法在 second.php 文件中接收这些值。帮我解决这个问题。我在下面附上我的代码:
<html>
<head>
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
{
$(document).mousemove(function(e)
{
$('#status').html(e.pageX);
$('#status1').html(e.pageY);
$.post("second.php",
{
x:10,
y:20
}, function coord(data)
{
$("#div1").load("second.php"); },"html"
}
});
})
</script>
<body>
<h2 id='status'>
</h2>
<h2 id="status1">
</h2>
<div id="div1"></div>
</body>
</html>
第二个文件通常接收 post 值并在添加后返回。我是走错了路还是有另一种方法可以做到这一点。帮我解决。