pandglobal
New Coder
Hello house, i am new to node js and i needed to run a task that makes an xhttp request to a given url every 20 secs.
So my hosting cpanel i saw nodejs setup, and after few clicks i got the setup running and the customer care for my hosting company said my nodejs setup was correct and running perfectly.
However am not getting the effect of the running as the expected xhttp request to the specific url is not working.
in my nodejs directory i created a file called NAME.js
And inside this NAME.js it has this simple code in it.
but this effect is not working as the process.php file is not getting any post to it every 20 secs
So my hosting cpanel i saw nodejs setup, and after few clicks i got the setup running and the customer care for my hosting company said my nodejs setup was correct and running perfectly.
However am not getting the effect of the running as the expected xhttp request to the specific url is not working.
in my nodejs directory i created a file called NAME.js
And inside this NAME.js it has this simple code in it.
JavaScript:
// NAME.js
var play = setInterval(function(){
const xhr = new XMLHttpRequest();
xhr.open("POST", "http://mydomain/process.php");
xhr.setRequestHeader("Content-Type", "application/text");
xhr.send('justtext');
}, 2000);
but this effect is not working as the process.php file is not getting any post to it every 20 secs