tags:

views:

9

answers:

1

I m tring to implement ajax polling in my code but i want to make sure that the server has an update before requesting for the data.How can I accomplish this?

+2  A: 

the entire point of polling is you don't know if the server is ready. If you knew, you wouldn't have to poll...

One thing you can do to make the load on the server lighter is increase the interval between polls the longer it takes. So, initially poll every 2 seconds, but after say five tries, go to five seconds, and after five tries, maybe give up and give a message. Depends on your specific use case though...

hvgotcodes
+1 for pointing out the logical contradiction in the question.
Kirk Woll
@kirk, yeah, sometimes its hard to see the forest from the trees....
hvgotcodes