Reputation: 3644
I'm using jquery to make an AJAX call that returns an HTTP 500 error. Works fine in firefox, but IE reports a 200 error. I know the PHP is right, because if I go to the page directly, it shows up as a 500 error. It's just the jQuery part that doesn't work in IE.
Here's the ajax call:
$.ajax({
url: "download.php",
data: {
removefile: filename
},
type: "GET",
dataType: "html",
success: function(html) {
alert("Success");
},
error: function(xhr, status, errorThrown) {
alert("Error: " + xhr.status);
},
complete: function(xhr, status) {
alert("Complete: " + xhr.status);
}
});
The php I'm using is something like:
header($_SERVER['SERVER_PROTOCOL'] . " 500 Internal Server Error", true, 500);
echo "Remove failed";
I'm testing on IE 9, but tried all of the different compatibility modes with the same issue.
Any ideas?
Upvotes: 1
Views: 728
Reputation: 3644
Duh! Changing the request type from "GET" to "POST" solves the problem. Guessing IE was caching the response. Not the same question, but Error with Internet Explorer and Jquery Ajax has a similar answer.
Sorry for the noise.
Upvotes: 1