I am encountering a unique issue with IE11 and ajax. Most of the time, everything works as expected when I use the code below for my requests. However, I have noticed that when I try to use it in combination with a copy and paste function, an 'Access is denied' error is returned. To summarize:
- This code functions normally in the majority of browsers for all the functions I have created
- In IE 11 + Windows 8.1, it works well except when running a specific copy and paste function
- Interestingly, even when using IE 11 with different Document modes such as 8, I still encounter the same error, despite working fine on IE8 + Windows 7
- The error message displayed is 'Access is denied'
Here is the AJAX script:
function ajaxRequest(requestName,responseFunction,parameters) {
var xmlhttp;
if (requestName.length==0) return;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if(xmlhttp.responseText == 'Error') alert('Error processing request. Please refresh the page and try again');
else if(xmlhttp.responseText != '') eval(responseFunction+"('"+xmlhttp.responseText+"')");
}
}
var now = new Date();
var url = "control/ajax.php?request="+requestName+"¶meters="+parameters+"×tamp"+now;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
An instance of failure occurred with the following variables set:
requestName: "save_marksheet_mark" responseFunction: "update_save_marksheet_mark" parameters: [60962,1284,5]
Is there any issue with this code? Why would IE11 specifically throw an error under certain circumstances?