6
運行下面的代碼,頁面可以正常加載dayofweek和hourofday函數。但在瀏覽器(Chrome)凍結並出現錯誤後不久:net :: ERR_INSUFFICIENT_RESOURCES並引用了jQuery庫和我的hourofday.js腳本。錯誤net :: ERR_INSUFFICIENT_RESOURCES在運行jQuery腳本2分鐘後發出ajax請求
幾分鐘後,它開始像瘋了似的錯誤,它凍結。我甚至無法重新加載頁面。
function dayofweek(){
$.ajax({
url: "dayofweek.php",
type: "POST",
dataType: "xml",
success: function (xml){
var day = $(xml).find('day').first().text();
$("#dayofweek").html(day);
},
error: function (xhr, status) {
},
complete: function (xhr, status) {
}
});
}
function hourofday(){
$.ajax({
url: "hourofday.php",
type: "POST",
dataType: "xml",
success: function (xml){
var response = $(xml).find('response').first().text();
$("#hourofday").html(response);
},
error: function (xhr, status) {
},
complete: function (xhr, status) {
}
});
setInterval(dayofweek, 6000);
setInterval(hourofday, 6000);
}