Back to all resources
form submission
page reload

Refresh after form submit

By Corey Moen
This JavaScript code snippet is designed to automatically refresh the current webpage 7 seconds after any form on the page is submitted. It uses jQuery to bind an event handler to the 'submit' event for all forms on the document. When a form is submitted, the setTimeout function is called, which sets up a delay of 7000 milliseconds (7 seconds) before executing location.reload(true). The true parameter passed to location.reload() forces the browser to reload the page from the server rather than from the cache.