Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pinging server through javascript(Using XMLrequest)

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i need to ping server from my client at repeated intervals . Currently i am using XMRequestObject().....to ping the server using .send method


Here is the script function used (javascript)

function pingServer()
{
if (window.ActiveXObject)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
if(req)
{
req.open("GET", '<%=request.getContextPath()%>/ping.do', true);
req.send();
}
}
setTimeout("pingServer()", 10000);
}


But the problem is that its entering the function everytime , but the call to the server is not happening everytime

can any one let me know whats the reason for this ??
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try playing with this: not sure if it will do what you want.



Eric
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi eric

Thanks a lot .it worked with same code as i had posted ..there was some problem with the server side code written

SOrry for the trouble

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic