I have a form being updated on AJAX call.
After Ajax call is succeeded, I want to reload that same page to reflect new changes.
I have used location.reload()
and window.location.href
after AJAX call is succeeded, a proper RELOAD on browser is performed but the form shows the old data, not new.
If I reload page using browser's reload button the newly updated data is shown.
But how do I reload a page properly using jQuery?
location. reload() reloads the current page with POST data, while window. location. href='your url' does not include the POST data.
The location. reload() method reloads the current URL, like the Refresh button.
Window location.reload() The reload() method reloads the current document. The reload() method does the same as the reload button in your browser.
After you set the specified URL into location, issue window. location. reload(true) . This will force browser to reload the page.
The method reload(forcedReload)
accepts a Boolean flag, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.
Please try:
// Reload the current page, without using the cache
document.location.reload(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With