Reputation: 304
I have an XMLHttpRequest that I'm sending to log in to a remote server. I'm taking the login parameters (username and password) and sending them as json. Here's my code:
var json_data = JSON.stringify({
"method": "login",
"user_login": user,
"password": password
});
var post_url = "server_url";
var crossRequest = new XMLHttpRequest();
crossRequest.open('POST', post_url, true); //Async
crossRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
crossRequest.withCredentials = true;
crossRequest.onreadystatechange = function () {
if (crossRequest.readyState == 4) {
alert("Logged in!");
}
}
crossRequest.onabort = function () {
alert("ERROR: Aborted.");
}
crossRequest.onerror = function () {
//alert("Error occurred, status: " + crossRequest.status);
}
crossRequest.onload = function () {
if (crossRequest.status == 200)
{
alert("Logged in!");
}
else
{
alert("An error occurred, status: " + crossRequest.status);
}
}
crossRequest.send(json_data);
It works just fine in Chrome, but in IE 11 it always aborts, seemingly before sending anything:
What could be causing this, and how can I fix it?
Upvotes: 2
Views: 8238
Reputation: 3697
• Press Alt, then go to Tools and turn off Enterprise mode if it’s not turned off yet.
• Go to Tools -> Internet Options -> Security -> Reset all zones to default level
• Go to Tools -> Internet Options -> Advanced -> Restore advanced settings
• Go to Tools -> Internet Options -> General -> Delete -> Temporary Internet Files and website files.
Upvotes: 0
Reputation: 6683
Seems like existing IE11 issue
IE10/IE11 Abort Post Ajax Request After Clearing Cache with error "Network Error 0x2ef3"
https://connect.microsoft.com/IE/feedback/details/852785/ie10-network-error-0x2ee4-https-proxy-ajax
Upvotes: 2