weixin_33719619 2015-08-26 22:36 采纳率: 0%
浏览 399

jQuery $ .post不起作用?

When I submit my form using $.post(), nothing happens at all. No error messages, no response, no nothing. It was working before, but it stopped working randomly.

This is my form:

<form id="login_form" class="drop-form" method="POST">
    <p class="lead">Sign in</p>
    <input class="form-control" name="user_email" type="email" placeholder="Email address" />
    <input class="form-control" name="user_password" type="password" placeholder="Password" />
    <input class="btn btn-sm btn-primary" type="submit" value="Sign in" />
</form>

and this is my jQuery:

$('#login_form').submit(function(e) {
    e.preventDefault();

    $.post("core/login.php", $(this).serialize(), function(res) {
        console.log('sent to core/login');
        // handle response
    }, 'json');
});

Chrome's browser console doesn't even show the "sent to core/login". What gives? Like I said, it was working before, and randomly it just stopped working.

  • 写回答

1条回答 默认 最新

  • 游.程 2015-08-26 22:41
    关注

    The 'sent to core/login' message would not appear until you get a success response back, so your problem is likely on the server side. The code you posted works fine client side, it's just not getting a response from 'core/login.php'

    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口