私の質問に対するほとんどのグーグル回答が構成されているため、これはクロスサイトリクエストの問題ではありません。
jquery 関数 .get および .load で ajax リクエストを作成しようとすると、xhr.status 0 och xhr.statusText "error" が発生します。ただし、Firebug では、要求されたページが html ステータス コード 200 で読み込まれます。応答のテキストを読み取ることができ、応答ヘッダーは正常に見えます。
私のコード:
function GetProjectTask(e) {
var loader = $('#' + e + 'tasks div.loader');
var content = $('#' + e + 'tasks div.content');
var img = $('#' + e + 'tasks img.collapseimg');
if (loader.html() == null || loader.html().trim() == '') {
if (content.html() == null || content.html() == '') {
img.attr('src', 'images/expanded.gif');
loader.html('<img src="images/loading.gif" alt="Wait..."> Loading support tasks');
content.load('includes/my' + e + 'tasks.php',
function (response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
alert(msg + xhr.status + " - " + xhr.statusText);
}
}
);
return;
}
}
content.empty();
loader.empty();
img.attr('src', 'images/collapsed.gif');
}
サーバー: IIS v.7.5 Jquery: v1.6.2
何か案は?