I would like to ask for your opinion on the topic. I can make my page refresh with both of these methods, but I do not know if they have any drawbacks. So, which one should I use?
Doing it via PHP would run for all users, but the bigger question is why do you need to refresh the page? And could you achieve the same thing without refreshing the page?