Reputation: 14568
Can anyone tell the jQuery code for automatic refreshing of a page?
i am using something like this -
jQuery(".form_" + form_count).html("<div id='message'></div>")
jQuery('#message').html("<center><h2><br><br>Thank You Your form has been submitted.</h2></center>")
window.setTimeout(function() {
history.go(-1);
}, 1950);
Now what i want is that after the browser has moved one page back to history that page should be refreshed . I tried using the above answers but no help.
Upvotes: 2
Views: 1235
Reputation: 490143
I've used...
window.location = window.location
But it turns out that...
window.location.reload();
...exists, and it also more semantically correct. Pass an argument as true
if you'd like to trigger a hard reload.
Of course, this is not jQuery. Remember jQuery is a JavaScript framework.
Upvotes: 1
Reputation: 1538
window.location.reload()
is equivalent to pressing the reload button in your browser.
window.location = window.location
is equivalent to pressing enter in the address bar.
When you call window.location.reload()
, all other resources are also revalidated. This means the cache fresness for all stylesheets, scripts and images is checked by performing extra HTTP-requests. At least in Firefox this behavior exists, I don't know how other browsers behave.
Upvotes: 0