Jquery 轮询json和显示覆盖时出现问题
我试图执行代码,我得到以下错误。 请让我知道可能是什么问题 未捕获引用错误:未定义轮询 谢谢 CSS:Jquery 轮询json和显示覆盖时出现问题,jquery,html,css,json,Jquery,Html,Css,Json,我试图执行代码,我得到以下错误。 请让我知道可能是什么问题 未捕获引用错误:未定义轮询 谢谢 CSS: #overlay { background-color: rgba(0, 0, 0, 0.2); z-index: 999; position: absolute; left: 0; top: 0; width: 100%; width: 100%; height: 100%; display: none; } &l
#overlay {
background-color: rgba(0, 0, 0, 0.2);
z-index: 999;
position: absolute;
left: 0;
top: 0;
width: 100%;
width: 100%;
height: 100%;
display: none;
}
<div id="overlay">
<div class="note note-warning" id="MyDiv" style="display:none">
<div class="block-warning">
<h4 class="block"> <i class="demo-icon icon-attention-1 fa"></i> Alert! Upgrade </h4>
<p>In progress.</p>
</div>
</div>
</div>
$(document).ready(function () {
(function poll() {
setTimeout(function() {
$.ajax({
url: "cgi",
type: "GET",
success: function(data) {
console.log("polling"+data);
if(data.state.is_running === false){
console.log("stop polling");
$("#overlay").show();
$("#commUpgradeAlertDiv").show();
}
},
dataType: "json",
complete: poll,
timeout: 2000
})
}, 50000);
})();
initPage();
}
HTML:
#overlay {
background-color: rgba(0, 0, 0, 0.2);
z-index: 999;
position: absolute;
left: 0;
top: 0;
width: 100%;
width: 100%;
height: 100%;
display: none;
}
<div id="overlay">
<div class="note note-warning" id="MyDiv" style="display:none">
<div class="block-warning">
<h4 class="block"> <i class="demo-icon icon-attention-1 fa"></i> Alert! Upgrade </h4>
<p>In progress.</p>
</div>
</div>
</div>
$(document).ready(function () {
(function poll() {
setTimeout(function() {
$.ajax({
url: "cgi",
type: "GET",
success: function(data) {
console.log("polling"+data);
if(data.state.is_running === false){
console.log("stop polling");
$("#overlay").show();
$("#commUpgradeAlertDiv").show();
}
},
dataType: "json",
complete: poll,
timeout: 2000
})
}, 50000);
})();
initPage();
}
对我来说很好->如何在上面的链接中看到结果。我看不到。你自己打开控制台(F12)也很好。最初工作正常,后来我看到错误消息。看起来响应很快。因此回调函数显示为未定义