douyuepi6485 2014-10-12 18:53
浏览 126

无法使用$ .post刷新页面

I am very confused and I cannot find the right way. I have a problem which I'll try to make it simple with the following example. First, code of test.php:

<html>
<head>    
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script src="test1.js"></script>
</head>

<body>

<input value="press" type="button" onclick="test()">
<script>
alert ("Home");
</script>

</body>
</html>

and now the test1.js code:

function test()
{
alert("Test1");
$.post("test.php");
}

From my point of view I'd expect three alert windows:Test1,Home and Test1 again for I thought test.php would refresh after $.post("test.php") is called. What am I missing? What is my fault?

I want to do exactly that in pages with more complex code (namely, to make a php page to refresh after a click button inside its own body which will execute some JS code first). I 'd appreciate your explanation and your solution as to clarify it.

  • 写回答

5条回答 默认 最新

  • douqian1835 2014-10-12 18:55
    关注

    You just send request to remote server and do not work with respond.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?