gpt4 book ai didi

php - 如何删除 "Warning: Unresponsive Script"

转载 作者:行者123 更新时间:2023-11-28 16:02:02 26 4
gpt4 key购买 nike

我正在使用像这样的 jQuery ajax 代码:

$.each(url_id, function(index, value) {
$.ajax({
async: false,
type: "POST",
url: "webservices/insert-manual.php",
data: { url_id: value},
dataType: "json"
}).done(function(response){
if(response.code == "200"){
$("#results").append('<div class="results-list"><strong>Well done!</strong></div>');
}else{
$("#results").append('<div class="results-list-error"><strong>Oh snap!</strong> There is no records to update in database.</div>');
}
});
});

当我运行此脚本时,我在 mozilla 警报中收到此错误消息。

A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

Script: http://localhost/jquery-project/js/jquery-1.7.2.min.js:2

这要求我 Stop ScriptContinue

如果我点击Stop Script然后它停止循环$.each或者如果我单击“继续”,它会继续运行更多代码,一段时间后它会再次询问我。

我的问题是如何删除此警报。

最佳答案

async: false,

这就是导致问题的原因。它会阻止您的 JavaScript,直到页面加载。删除它。

这意味着您正在尝试同步运行代码,例如处于阻塞模式。

关于php - 如何删除 "Warning: Unresponsive Script",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16667043/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com