How to write a function that will communicate and ready the service being used with a simple message. The service is taking a while to load because it goes dormant when not being used so it has to "wake up" every time. So basically I need a function that communicates with server after document.ready to wake up, so then when the user searches for something in the service it doesn't take forever to load because it will already be loaded. Is this on the right track?
function sayHello() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", 'service', true);
receiveReq.onreadystatechange = handleSayHello;
receiveReq.send(null);
}
}