Home  >  Q&A  >  body text

JQ counts down every 10 minutes

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


按键盘手指磨破皮按键盘手指磨破皮2533 days ago1839

reply all(4)I'll reply

  • 濤

    2020-03-30 19:44:52

    Brother, have you implemented this function? Can you teach me?

    reply
    0
  • NULL

    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

    reply
    0
  • ringa_lee

    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?

    reply
    0
  • 按键盘手指磨破皮

    Yes, that’s what it means, it’s like the lottery or flash sale countdown on many websites, but what I want is a non-stop loop, and the countdown will start again immediately after it ends. For example, 10,9,8...1,0,10,9,8... Because I am afraid that there will be cheating posts, I need to compare it with the server time.

    按键盘手指磨破皮 · 2017-12-06 19:13:23
  • Cancelreply