Countdown function connected to ajax
I currently have an PrimeFaces <p:poll> ajax poll function that executes every 90 seconds to refresh some data. I've been asked to make this visual and I'm just wondering the quickest/lightest way of doing so?
The way I am thinking is I have two options:
Find/Build some sort of count down timer in jQuery/JS and like above execute when it's finished counting down.
Hopefully somebody has a cleaner/better method.
I think for this case, it would be better to use <p:remoteCommand instead of <p:poll.
That way you can code the countdown/display using JQuery and call the remote-command and reset the count to 90 when the count reaches 0.
A problem with using <p:poll is that the poll's timer and the display timer won't synchronize.