The project requires a draw every 10 minutes, which needs to be synchronized with the server time to prevent cheating
My idea is to use ajax to get the server time every 10 seconds, and then use JQ to compare the countdown.
For example, the time I retrieved is 18:02
The time I drew the lottery is 18:09 18:19 18:29 and so on
Then the logic of JQ should be How to write it? The countdown time on the front-end page always cycles from 10 minutes to 09:59 09:58. The display like this
needs to be calculated based on the server time. How to write this logic
NULL2017-12-07 13:28:14
Can be achieved through Soket, Soket is a way for the client to establish a long connection with the server to achieve instant communication effect
ringa_lee2017-12-06 09:18:16
Can you describe it more specifically? Do you mean that ajax requests the server time every 10 seconds, and then the time obtained is used to count down the front-end for the lottery?