0

my code :

setInterval(getRndInteger, 2000);
function getRndInteger() {
let x = Math.floor(Math.random() * (100 - 15)) + 15;
document.getElementById("demo").innerHTML = x;
}
<p id="demo"></p>

result is a random number between (15-100) every 2 sec, i want take that number to php, how to ?

1 Answers1

0

You cannot do that! Because php is the server language but the JS is the front-end language!

if you want to do that, you have to send a request to the php code and send the data with axios or ajax!

You can get data from php in JS but you cannot get data from JS in php, in order to do that you have to send a http request to your php server code as I mentioned !