I have the following piece of code:
// setup the AJAX request
var pageRequest = false;
if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest();
else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
// callback
pageRequest.onreadystatechange = function() {
alert('pageRequest.readyState: ' + pageRequest.readyState
+ '\npageRequest.status: ' + pageRequest.status);
}
pageRequest.open('POST','ajax.php',true);
// q_str contains something like 'data=value...'
pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
pageRequest.setRequestHeader("Content-length", q_str.length);
pageRequest.setRequestHeader("Connection", "close");
pageRequest.send(q_str);
This works fine in Chrome, but IE chokes on it, spitting out an "Unspecified error." and it points to the line with the alert() in it. Why can't it display the alert?