3

jQuery 1.7.1 を使用しています。Ajax Form pluginとともに、最新バージョンが利用可能です。次のような Ajax リクエストを行う場合:

$('form').ajaxForm (
{
    success: function ( data )
    {
        alert ( data.responseText );
    },
    error: function ( data, status, error )
    {
        alert ( data.getResponseHeader('Content-type') );
    }
}
);

リクエストがエラーを返した場合、IE (私の場合は IE9) は常に Content-type ヘッダーまたはその他のヘッダーに対して undefined を返します。data.responseText プロパティも null を返します。これは、Gecko または Webkit ブラウザーには当てはまりません。

以下は、Ajax 要求が返す応答ヘッダーの例です。

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

IE でこの動作を回避する方法について何か考えはありますか?

4

1 に答える 1