If the current page was loaded by a POST request, you may want to use
window.location = window.location.pathname;
instead of
window.location.reload();
because window.location.reload()
will prompt for confirmation if called on a page that was loaded by a POST request.