IF条件在Javascript中无法正常工作
我这里有这个脚本,如果responsetext不等于'Status:Empty',我希望我的按钮被禁用。。但它不起作用IF条件在Javascript中无法正常工作,javascript,php,ajax,Javascript,Php,Ajax,我这里有这个脚本,如果responsetext不等于'Status:Empty',我希望我的按钮被禁用。。但它不起作用 setInterval(function() { var http = new XMLHttpRequest(); var url = 'tryingsomething.php'; http.open('POST', url, true); http.onreadystatechange = function() { if(http.readyState == 4 &
setInterval(function() {
var http = new XMLHttpRequest();
var url = 'tryingsomething.php';
http.open('POST', url, true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
document.getElementById("wss").innerHTML = this.responseText;
if (this.responseText !='Status: Empty') {
document.getElementById("myBtn").disabled = true;
}
}
}
http.send();
}, 1000)
console.log(this.responseText)
的结果是什么?结果是一个倒计时,当它达到0h 0m 0s时,它会显示“Status:Empty”而不是计时器,因此我希望在仅倒计时时禁用按钮console.log(this.responseText)的结果是什么
?结果是倒计时,当它达到0小时0米0秒时,它会显示“状态:空”而不是计时器,因此我希望按钮在仅倒计时时被禁用