When interacting with a server through an XMLHttpRequest to post data, the code typically follows this structure:
var xhr = new XMLHttpRequest();
var url = 'http://myurl/post';
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
if (xhr.status == 200) {
leaveEditMode();
} else {
initOverlay('Error: ' + xhr.statusText);
}
}
};
xhr.send(
'StringName=' + $activeElement.dataset.name + '&' +
'Text=' + encodeURIComponent($activeElement.innerHTML) + '&' +
'Language=' + userLanguage
);
This code functions properly on Chrome, FireFox, and Opera. However, when testing it on IE11, despite receiving status code 200 without any errors, the data does not get posted. It seems like the request is being ignored.
Have you encountered similar issues? I attempted using an anti-cache-header with no success.
Your insights would be greatly appreciated! :-)