を使用するgetScript()
場合は、成功コールバックを使用して関数を実行できますが、それはスクリプトの読み込みが完了したときのみです。
読み込みインジケーターの画像( http://ajaxload.info/で多く見つけることができます)を用意し、スクリプトが読み込まれたときに非表示にすることをお勧めします。
このSOには他にもいくつかのアイデアがあります。1つの解決策は以下のとおりです。
var myTrigger;
var progressElem = $('#progressCounter');
$.ajax ({
type : 'GET',
dataType : 'xml',
url : 'somexmlscript.php' ,
beforeSend : function (thisXHR)
{
myTrigger = setInterval (function ()
{
if (thisXHR.readyState > 2)
{
var totalBytes = thisXHR.getResponseHeader('Content-length');
var dlBytes = thisXHR.responseText.length;
(totalBytes > 0)? progressElem.html (Math.round ((dlBytes/ totalBytes) * 100) + "%") : progressElem.html (Math.round (dlBytes /1024) + "K");
}
}, 200);
},
complete : function ()
{
clearInterval (myTrigger);
},
success : function (response)
{
// Process XML
}
});
これにより、ロードされたバイトと合計バイトを取得して進行状況を計算する間隔が設定されます。これはあなたのために働くかもしれません。