I have a button which, when pressed, should reload the page. I use location.reload()
to perform the action (following the answers on how to reload a page with JS).
The code I used (available on codepen.io)
HTML
<button class="reload">update</button>
<div class="radio"></div>
JS
$('.reload').click(function() {
alert('clicked');
location.reload(true);
});
window.onload = function() {
$('.radio').text($.now());
};
The pages initially loads with the current Epoch counter but clicking the button does not update it.
I also tried to use $(document).ready()
in case window.onload
would not be triggered by location.reload()
- same result.
How can I force a page reload in this scenario?