I set a cookie with Javascript. I have a input type checkbox that will switch theme on the website from normal to classic version and so will the cookie name. My backend is PHP. I want to access the newly changed value when clicking the checkbox with PHP, so naturally i want to reload the page so PHP can pick up the new value. Here comes the problem, all the suggestions out there suggest this:
location.reload(true);
But my Visual Studio Code says this is deprecated and indeed, it does not work indeed.
I checked MDN - [https://developer.mozilla.org/en-US/docs/Web/API/Location/reload][1] and it says that i should not pass any params and just use
location.reload();
And yes, using this reloads the page but it seems like it doesn't reload it by requesting the page from the server because my PHP does not pick up the new value. Only when i hit the refresh button manually, it does. And MDN says "The Location.reload() method reloads the current URL, like the Refresh button." which doesn't seem true.
So what can i do here?