Continual counter regardless of page refresh

后端 未结 5 1763
不知归路
不知归路 2021-01-13 17:14

I have this piece of jQuery that currently increments a number by one every 5 seconds. The problem I have is that its client side, therefore it resets every time you refresh

5条回答
  •  野的像风
    2021-01-13 17:38

    It comes down to two simple choices for you. Just choose the right one which better fits your requirement:

    Choose Cookie : If you want the server side to access the counter. Remember cookies are sent along with the requests by default.

    Choose Local Storage : If you don't want to send the counter along with requests every time, you are supposed to go for local storage.

提交回复
热议问题