I'm submitting a form using an ajax request (POST method), and checking the HTTP status code on the response to see if it was successful or not.
It works fine on Firefox, but of course doesn't on MSIE-8. The submission actually works fine, I can check my server and confirm that the submission worked and the server responded with a status code of 204. Again, firefox correctly gives me the status code of 204 from the request object, but IE gives a status code of 1223.
Any ideas how I can get an accurate status code in MSIE? The code that submits the form and checks the response is below.
var req = new XMLHttpRequest();
req.open("POST", "p.php?i=" + self.__isid, true);
//Send the proper header information along with the request
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", formdata.length);
req.setRequestHeader("Connection", "close");
req.onreadystatechange = function()
{
if(req.readyState == 4)
{
if(req.status == 204 || req.status == 200)
{
//Success. Update the feed.
self.__postFeed.update();
self.__form.reset();
}
else
{
//TODO: Better error handling.
alert("Error submitting post:\n" + req.responseText);
}
}
}
req.send(formdata);