jQueryを使用して、phpファイルからjson形式のデータを要求してアイテムのリストを表示するアプリケーションを構築しています。私のスクリプトは Chrome と Firefox で完全に正常に動作していますが、IE に関しては奇妙な動作をしています。 .. 寛大な休憩の後、ほとんどの場合、負荷がかかります。IE がすべてのデータをロードするのに何秒もかかるだけなのか (Chrome と Firefox は数ミリ秒ですべてをロードするので、これは奇妙なことです)、または検出されないスクリプトに問題があるのかどうかはわかりません。
ここに、ロードに関連するスクリプトの一部を投稿します。
/*
This function hides the div containing the "Loading data..." message
as the loading is complete.
*/
$.hideLoading = function() {
$("#loading").hide();
$("#searcharea").show();
};
/*
This function is responsible for getting the data from the php file and "shouts"
when it's finished.
*/
$.getData = function(field) {
return $.ajax({
url: 'lib/getData.php',
data: { d: field },
datatype: 'json'
}).promise();
};
/*
When the two functions are done, hideLoading() is fired causing the "Loading data..."
message to disappear.
*/
$.when(catData = $.getData('cat'), giftsData = $.getData('gifts') ).done(function() {
$.hideLoading();
});
/*
They hand the loaded data to functions that will process it.
*/
catData.then(function(data) {
$.parseCategories(data);
});
giftsData.then(function(data) {
$.parseGiftData(data, targetId);
giftsDataObj = data;
});
IE を 1 回おきに動作させるこのコードに問題はありますか? 実際の負荷があることを何らかの方法で検出できますか? 率直に言って、それがどのように機能するのか理解できず、その後... 行き詰まります。
編集:スクリプトからすべてを削除しconsole.log
ましたが、IE を起動して初めてページを読み込むと、スクリプトは正常に動作するように見えますが、ページをリロードしようとすると、スクリプトが動かなくなります。