I have a button which loads after a ajax call , on clicking i want to reload the page (like i press f5)
I tried
$( ".delegate_update_success" ).click(function() {
location.reload();
});
but it does a simple refresh, but my page does not makes a new request to get the contents. It should happen just like I am entering URL to get that page.
This question is related to
javascript
jquery
You can also use window.location.href=window.location.href;
Use document.location.reload(true)
it will not load page from cache.
If your button is loading from an AJAX call, you should use
$(document).on("click", ".delegate_update_success", function(){
location.reload(true);
});
instead of
$( ".delegate_update_success" ).click(function() {
location.reload();
});
Also note the true
parameter for the location.reload
function.
simple way can be -
just href="javascript:location.reload(true);
your answer is
location.reload(true);
Thanks
Use this line simply inside your head with
window.location.reload(true);
It will load your current page or view.
use window.location.href = url
Source: Stackoverflow.com