我发布的脚本工作正常,它只是在页面加载时在后台执行我的 php 代码。我不能做的是在按下提交按钮后在后台启动 php。我试图在正文,但我不知道如何将它与 ajax 链接.. 怎么办?谢谢!
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: 'trial.php',
beforeSend: function() {
// you could also put a spinner img or whatever here too..
$("#myStatusDiv").html("started..");
},
success: function(result) {
$("#myStatusDiv").html(result);
}
});
});
</script>
</head>
<body>
</body>
</body>
</html>