What causes my XMLHttpRequest to be terminated prematurely?

My code utilizes an XMLHttpRequest to log in to a remote server by sending login parameters (username and password) as JSON. Here is my code snippet:

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);

While this code works in Chrome, it consistently aborts in IE 11 before sending anything:

What could be causing this issue in IE 11 and what steps can be taken to resolve it?

Answer №1

It appears to be a known issue with IE11

Check out this link for more information

IE10/IE11 Ajax Request Issue After Cache Clearing

More details on IE10 Network Error Issue

Answer №2

• Start by pressing the Alt key on your keyboard, then navigate to the Tools menu and make sure to deactivate Enterprise mode if it's still active.
• After that, head to Tools > Internet Options > Security and hit the button to reset all zones to their default levels.
• Next, go to Tools > Internet Options > Advanced and click on the option to restore advanced settings.
• Finally, in Tools > Internet Options > General, select the option to delete Temporary Internet Files and website files.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transforming URLs with a .php extension to .aspx using IIS server

I am managing a PHP website hosted on IIS 8.5 on Windows Server 2012. The task at hand is to update the URL structure by changing the extension of one particular page from .php to .aspx. To provide an example, let's consider my site www.abc.com where ...

What is the best way to implement JQuery Ajax in order to invoke a PHP file on the server side, which will then execute returned javascripts?

I am currently working on a client website that requires a cross-domain JQuery Ajax call to a PHP file on my server. The purpose of this call is to query the database for various stored JavaScripts, which will then be returned to the client and executed on ...

Issues with Angular route links not functioning correctly when using an Array of objects

After hard coding some routerLinks into my application and witnessing smooth functionality, I decided to explore a different approach: View: <ul class="list navbar-nav"></ul> Ts.file public links = [ { name: "Home&quo ...

I am facing an issue with effectively passing properties from a parent state to its child component

In the Login component, I set the authentication state using the token as false initially. After a successful login, the token is changed to true. function Login() { const [user, setUser] = useState({ name: '', email: '' }); const [ ...

HTML - Transforming JSON data into a table

I'm having trouble converting JSON data into a table format. Although everything seems to be in order, I am unable to view the values on my table. Here is the code I am using to convert JSON to a table: $(function() { var my_data = &ap ...

What are the best practices for securely storing SSL certificates and public/private keys?

I possess keys that appear like this. MIID0DCCArigAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJGUjET MBEGA1UECAwKU29tZS1TdGF0ZTEOMAwGA1UEBwwFUGFyaXMxDTALBgNVBAoMBERp bWkxDTALBgNVBAsMBE5TQlUxEDAOBgNVBAMMB0RpbWkgQ0ExGzAZBgkqhkiG9w0B CQEWDGRpbWlAZGltaS5mcjA ...

Tips for fading an image as you scroll using CSS and JavaScript?

I have been dedicating my day to mastering the art of website development. However, I am facing a challenge that is proving to be quite difficult. I am looking to create a smooth transition effect where an image gradually blurs while scrolling down, and re ...

Effortless form submission with jQuery plugin and CakePHP 2 using AJAX

Trying to figure out how to use the jquery form plugin to upload an image via ajax. I'm looking to display the saved version of the image on the same page that initiated the request. Although I'm new to cakephp and jquery, I've been grapplin ...

"Encountering issue with componentDidMount() not functioning as expected, despite debugger being

Hello everyone! This is my first time sharing something here, so I'm eager to hear your feedback on both how I've posted and the content itself. I've only been programming for 8 weeks now, so I'm sure there are plenty of mistakes in wha ...

JavaScript JQuery alert popup fails to display

I have been attempting to create an alert pop-up using JQuery that will display when a user clicks on submit without filling out the form. However, when I test my code by leaving the form empty and clicking 'submit', the page just refreshes with ...

Dealing with React Native text overflowing beyond the screen width when using FlexWrap

I'm currently working on implementing a component in react native that consists of a row containing and components, but I'm struggling to achieve the desired outcome. Here's my current code: <View style={{ flexDirection: ...

Retrieving Remote Headers in Loopback.io Inbound HTTP Method

In my remote method, I have placed the application logic as shown below: module.exports = function(Entity) { HcpEntity.retrieveProfile = function(body, cb) { process.nextTick(function() { //TODO: Add Application Logic here } } } Also, he ...

Why does the session variable keep changing after two page reloads?

CodeSnippet.php <?php session_start(); msgbox("Confirm your action: Are you sure?", "confirm"); $Result = $_SESSION['id'] ; print "<p id='txt'> </p>"; if($Result == 1 ) echo "Result is true"; elseif ( $Result == 2 ) ...

Obtain the numerical value of the vertical position of the mouse (

Currently, I am coding a JavaScript game and my objective is to designate a variable specifically for the Y axis of the mouse. I kindly request that the code be kept as simple and straightforward as possible, avoiding unnecessary complexity. That conclud ...

Is the presence of an excessive number of arguments in the object that includes functions an instance

In my program, I have implemented a feature where the user can provide an array to determine which functions are executed in a loop. However, managing the list of variables that need to be passed into each function has become challenging as the list keeps ...

The page you are trying to access does not support the HTTP request method 'GET'. Please try a different method to access the page

I have been attempting to incorporate AJAX for asynchronous communication with the server. However, I keep encountering the following error message. Any insights on how to resolve this issue? org.springframework.web.servlet.PageNotFound.handleHttpReques ...

What causes an undefined outcome when a promise is fulfilled?

Could you help me understand something? const promise1 = new Promise((resolve, reject) => { setTimeout(() => { if(true) { resolve('success') } else { reject('failure') } }, 4000) }) promise1.then(resul ...

What is the best way to simulate a static variable in JavaScript unit testing?

After running the karma coverage test, I achieved a coverage of 99.3%. To reach 100%, I require assistance in testing the else part of the function below: createCurrencyUnits(): void { var keys = Object.keys(ObjectsDomainConstants.CURRENCY_UNITS); for (va ...

What is the best way to display database information on my webpage according to the selected item in the combo box?

Whenever I visit my sample.php page, the only thing that appears is my combo box. However, when I start selecting a value from the combo box, that's when the data from my database, which is fetched from getyear.php, is displayed. What I want to achie ...

Three.js object changing position along the curve of a bowl

I am currently developing a threejs game. My goal is to have a ball move from the z-position of -5000 to 0. This is how I am creating the mesh: let geometry = new THREE.SphereGeometry(100, 32, 32); let material = new THREE.MeshBasicMaterial({ ...