Multiple timers on the page, how do you implement?
It is necessary to make multiple independent countdown timers, though the date of the end event is fetched from the database, tell me how this can be implemented, or maybe someone knows useful links on this subject. In addition you need to the expiry of the period occurred some action such as recording certain information in a DB, but as far as I know the timer is client side, ie when the page is not open, the timer is not working, and need to work always.
4 answers
It is sad to think that will be for the game on exit, if such ask.....
need to expiration there is some action such as recording certain information in a DB
Why?
It is used in games such.
> the date of the end event is fetched from the database
Query in the database we get the date, pass the JS from it or to it run the report
> at the end of the period was some action such as recording certain information in a DB
But this means that the timer should work on the server more and not just for JS because if the client closes the browser it resets.
In short look about the timers in browser-based games.
On the server you will need cron or at.
Find more questions by tags PHPJavaScript