Answer the question
In order to leave comments, you need to log in
How to not send a response to a request under certain conditions?
Hello! I have been struggling with this mini-code for several hours now:
<?php
$date = new DateTime();
$minutes = $date->format("i");
if($minutes%2 == 0){
print "Сервер отправил запрос";
}
?>
function subscribe(url) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState != 4) return;
if (this.status == 200) {
console.log(this.responseText);
} else {
console.log(this);
}
subscribe(url);
}
xhr.open("GET", url, true);
xhr.send();
}
subscribe("http://comet/php.php")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question