I want to create a button to reload a page without losing $_POST
data and $_SESSION
.
On the web, I found this piece of code:
onclick="document.location.reload();"
And here is the code of my button:
<a class="button" href="" style="font-size: 0.7em; padding: 5px 10px;" onclick="document.location.reload();">Recharger la page</a>
But when I click on the button, I lose $_POST
data and $_SESSION
.
If I try with the keyboard command Ctrl+R (Chrome) or F5 (Firefox, IE9), the browser is showing an alert to notify me that I'm again trying to submit form. If I accept, it works.
How can I reproduce this kind of browser-refresh with a JavaScript command? Or is the code of my button wrong?
Thank you very much for your help.