I've tried this two ways.
Way 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);
}
Way 2
function Login() {
var email = encodeURIComponent($("#loginemail").val());
var pass = encodeURIComponent($("#password").val());
$.post("/user/login", {email:email, password:pass}, LoginDone);
}
Both ways work fine on chrome, but for some reason with IE it doesn't send the data {email:email, password:pass}
in the POST
, or at all.
I've tried both on a local server, and on a live webserver, both with the same results.
Using IE10 here.
should be
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 variableencodeURIComponent($("#loginemail").val())
.This is likely not an IE10 issue, this shouldn't work as written in any browser.
Update
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.
After deep debuggind I found a workaround for IE10 AJAX POST Bug:
do not use POST with GET.
change to
Try this: http://code.gishan.net/code/solution-to-ie10-ajax-problem Works for me. This is a known issue of IE10.
Can't fix @jQuery bug tracker: AJAX Post on IE10 / Windows 8
IE-10 does not work data serialize => $(this).serialize()
For this you can use this line on _layOut.chtml before metatag. So, IE-10 works just like IE-9.
I've had the same problem with IE 10 (10.0.9200.16521) on Win7 x64 SP1. I've solved the problem simply by using a newer version of jQuery (1.9.1 in place of 1.8.3)