I have been developing an AJAX calendar that functions perfectly in Chrome, Safari, and Firefox. However, I am encountering issues with Internet Explorer 9 and earlier versions.
The error message I am receiving is SCRIPT 600: Invalid target element for this operation.
This calendar is implemented as a WordPress plugin, and here is the relevant code snippet:
function displayMicroAjax(response) {
document.getElementById('wp-calendar').innerHTML = response;
}
function microAjaxRequest(url, callbackFunction) {
this.bindFunction = function(caller, object) {
return function() {
return caller.apply(object, new Array(object));
}
};
this.stateChange = function(object) {
if (this.request.readyState == 4) {
this.callbackFunction(this.request.responseText);
}
};
this.getResponseObject = function() {
if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest) return new XMLHttpRequest();
else return false;
};
if (arguments[2]) this.postData = arguments[2];
else this.postData = "";
this.callbackFunction = callbackFunction;
this.url = url;
this.request = this.getResponseObject();
if (this.request) {
this.request.onreadystatechange = this.bindFunction(this.stateChange, this);
if (this.postData != "") {
this.request.open("POST", url, true);
this.request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
this.request.setRequestHeader('Connection', 'close');
} else {
this.request.open("GET", url, true);
}
this.request.send(this.postData);
}
}