jQuery reload entire page after Confirm alert is clicked

jQuery.  Is there a way to reload an entire page, after a confirmation alert is clicked?
LVL 8
rgranlundAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Commented:
Sure, use "window.location.reload()".

https://developer.mozilla.org/en-US/docs/Web/API/Location

(No, EE admins, more details aren't needed for that.)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dénes KellnerCommented:
One of the solutions is location.reload(), as David mentioned. This will refresh your page and stay at the scrolled position. If this is what you want, go with it.

If you want to refresh the page and go to the top, use "location.href = location.href" instead; this will reload and go to the top which is sometimes useful when the page content changes a lot due to user action. Side effect: this will use a GET request even when the original page has been shown by a POST. Also useful to avoid the confirmation nagging in some postback situations.

Also, you can give location.reload() an argument (true/1/something) to make sure it fetches every resource - this is the equivalent of Ctrl-F5. Use this when the user action involves "heavy" items that are usually cached, typically images.

Finally, you can make "indoor reloads" with jQuery which allows you to only replace a dom element with the fetched fresh contents. See $.load() on this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.