FF、Safari ではアップロードの進行状況バーが動作していますが、IE では動作していません。
jquery.form に基づいてフォームが送信されますが、アップロードが完了すると、PHP アプリはまったく新しいページを送信します。これは xhr.responseText で受信されます。応答は新しいドキュメントに配置されます。
これはFFで問題なく機能します...
IE では、responseText は "\n <table class=..." で始まります。つまり、<body> タグ内のテキストです (<html> ... </html> ページ全体ではありません)。
どうしたの?応答ですべてのタグを保持するように IE を取得するにはどうすればよいですか?
アップデート:
私は使っている:
- jQuery フォーム プラグイン
- バージョン: 3.35.0-2013.05.23
接続する jq は次のようになります。
$('#JQF').ajaxForm({
dataType: 'html',
beforeSend: UP.start,
success: UP.stop
});
UP.stop:
function (html, status, xhr) {
startTime = null;
setTimeout(function () {
jsonForm.success(html, status, xhr);
}, 10);
}
と
jsonForm.success:
function(responseText, statusText, xhr, elt)
/*
1.) responseText or responseXML value (depending on the value of the dataType option).
2.) statusText
3.) xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
4.) jQuery-wrapped form element (or undefined if using jQuery < 1.4)
)
*/ {
if (typeof responseText === 'string')
{
if (/<html>/i.test(responseText))
{
jsonForm.reloadMain(responseText);
}
else if (responseText)
{
alert(responseText); <<<========== this is executed.
}
}
else if (responseText && typeof responseText === 'object')
{// decode and execute jquery instructions
jsonForm.responseEval(responseText, {});
jsonForm.init(); // in case we loaded something with a jsonForm in it
}
}
更新 2:
戻り値を制限する iframe の使用をオフにするには、ajaxForm オプション iframe: false を含める必要があります。