Reputation: 3568
I have a problem with the following code. When I run it in IE8, I get an alert when I have a successful return from the call.
This does not happen in Firefox and Chrome, i.e. I get no alert when running it there. Everything else works, except that it seems to me like the code section which is supposed to execute once the call is successful fails.
function stuffFile(file, wfid) {
var xmlhttp = new XMLHttpRequest();
if(window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "http://someotherserver.page.aspx";
var params = "fileName=" + file + "¶m11=" + wfid;
xmlhttp.open("POST", url, true);
//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
//alert('onready');
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var response = jQuery.trim(xmlhttp.responseText);
alert('response ' + response);
}
}
xmlhttp.send(params);
}
Upvotes: 0
Views: 363