I'm using dojo.xhrPost to sent Ajax Requests
The call is wrapped by a function sendRequest()
I've now to continuously (every 3sec) send the same ajax Post to the server
How can I implement a Server Poll with Dojo? I basically need to call sendRequest()
every 3 secs
I have found it better to do like this:
The benefit of this procedure is that you can easily throttle poll intervals, works fine when certain xhr operations time out, and can easily implement privatization of polling requests.
I don't believe that Dojo has a method built-in for polling, so here's a generic method that's applicable across frameworks
Usage:
Or in your case:
If you want this as a Dojo package, then the following is a trivial extension:
Usage:
To continuously update your grid you can include your ajax request in the 'refresh-complete' callback function of the grid.