Reputation: 201
I am using AJAX action after getting the response, I want to reload the current page, for which I am using:
window.location.reload();
It works fine on Firefox and IE, but it's not working for Chrome; the content which I want display empty.
Is there way to reload the page in chrome?
window.opener.document.location.reload();
self.close();
Upvotes: 13
Views: 59453
Reputation: 97
If you are working with AJAX, you have to do the reload inside the success function.
$.ajax({
type: 'POST',
data: '',
url: '',
success: function(data){
setTimeout(function(){
window.location.reload();
},100);
},
error: function(){
}
Upvotes: -2
Reputation: 325
Try this:
window.opener.location.reload(true);
window.self.close();
This works for me on all major browsers.
Upvotes: -2
Reputation: 612
Not sure why, but in my case i fixed it by wrapping the reload() call in a setTimeout with 100 ms.
setTimeout(function(){
window.location.reload();
},100);
Upvotes: 16
Reputation: 574
Try this to reload page using JavaScript.
window.location.href = window.location.href;
Upvotes: -2
Reputation: 1
Try:
parent.window.location.reload();
This doesn't work in Firefox 17 for me.
The only other way I know that works in all browsers is to redirect to another blank page and redirect back to the current page.
Upvotes: -1
Reputation: 530
try the below:
window.location = self.location;
above code does not work for some browsers, you can even try:
location.reload( true );
Upvotes: 8