Here's a vanilla javascript that will check a server periodically:
var timer;
function checkStatus(){
var xhr = new XMLHttpRequest();
xhr.open('GET','Your web service address');
xhr.onreadystatechange = function(){
if (xhr.readyState == 4) {
if(req.status == 200){
}
else{
}
}
}
xhr.send();
}
function startListening(){
timer = setInterval(checkStatus,1000);
}
function stopListening(){
clearInterval(timer);
}
startListening();
Add logic to the load and error event callbacks and add the address where indicated. Make it POST if you need to.