I am using jQuery 1.7.1. along with the Ajax Form plugin , the latest version is available. When I make an Ajax request, for example:
$('form').ajaxForm (
{
success: function ( data )
{
alert ( data.responseText );
},
error: function ( data, status, error )
{
alert ( data.getResponseHeader('Content-type') );
}
}
);
If the request returns an error, IE (IE9, in my case) will always return undefined for the Content-type header or any other header. The data.responseText property also returns null. This does not apply to Gecko or Webkit browsers.
This is an example of response headers returned by an Ajax request:
Response HTTP/1.1 400 Bad Request
Date Fri, 18 May 2012 08:15:32 GMT
Server Apache/2.2.14 (Ubuntu)
X-Powered-By PHP/5.3.2-1ubuntu4.15
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Connection close
Content-Type text/html
Any idea on how to get around this behavior in IE?
source
share