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);
}