jQuery的阿贾克斯$。员额不工作IE10 [英] jquery ajax $.post not working IE10

查看:154
本文介绍了jQuery的阿贾克斯$。员额不工作IE10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经试过这两种方式。

I've tried this two ways.

路1

function Login() {
    var email = encodeURIComponent($("#loginemail").val());
    var pass = encodeURIComponent($("#password").val());
    $.ajax({
        url:"/user/login",
        type: "POST",
        data: {email:email, password:pass},
        dataType: "json"
    }).done(LoginDone);
    //$.post("/user/login", {email:email, password:pass}, LoginDone);
}

路2

    function Login() {
        var email = encodeURIComponent($("#loginemail").val());
        var pass = encodeURIComponent($("#password").val());
        $.post("/user/login", {email:email, password:pass}, LoginDone);
    }

这两种方式做工精细的镀铬,但由于某些原因与IE浏览器就不会发送数据 {电子邮件:电子邮件,密码:通} POST ,或在所有。

我已经在本地服务器上尝试都和在实时网络服务器,两者具有相同的结果。

I've tried both on a local server, and on a live webserver, both with the same results.

这里使用IE10。

推荐答案

<打击>

data: {email:email, password:pass}

data: {"email":email, "password":pass}

正在传递变量的值作为重点,所以如果你的服务器端资源期待电子邮件它实际上是看到那个变量<$ C $的价值C>连接codeURIComponent($(#注册邮箱)。VAL())。

You are passing the value of the variables as the key so if your server-side resource is expecting email it is actually seeing the value of that variable encodeURIComponent($("#loginemail").val()).

这可能不是一个IE10的问题,这应该无法正常工作写在任何浏览器。

This is likely not an IE10 issue, this shouldn't work as written in any browser.

更新

这答案可能不再适用,由于在IE 10的错误修复。

This answer may no longer be applicable due to bug fixes in IE 10.

请忽略这个答案是错误的,不能因被接受被删除。

Please disregard this answer it is wrong and cannot be deleted due to being accepted.

这篇关于jQuery的阿贾克斯$。员额不工作IE10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆