私の目的は、AJAX呼び出しを行っている間、読み込み中のポップアップ(GIFを含む)を表示することです。CSSを使用してGIFアニメーションを挿入するjQueryUIモーダルダイアログを使用しています。以前、AJAX呼び出しが開始されましたが、ダイアログを開いて、呼び出しが終了するとすぐに閉じます。問題は、AJAX呼び出しが実行されているときにGIFが機能しなくなり、すべてのブラウザーで発生していることです。私は次のコードを使用しています:
<div id="loadingScreen" title="Loading">Please wait...</div>
#loadingScreen {
background: url(http://regretless.com/stuff/jQuery/images/loading.gif) no-repeat 5px 8px;
padding-left: 25px;
}
$("#loadingScreen").dialog('open');
setTimeout(function () {
$.ajax({
type: "GET",
url: "testing.txt",
async: true,
dataType: "text",
success: function (returnText) {
$("#viewDescription").text(returnText);
$("#viewGroupID").text(" " + t.id);
$("#loadingScreen").dialog('close');
$('#View').dialog('open');
},
error: function (xhr, status, error) {
$("#loadingScreen").dialog('close');
alert("An error has occured");
}
});
}, 10);
誰かが問題が何であるか教えてもらえますか?