Reputation: 2579
Is it possible to use javascript:location.reload(true) as a action= for a form without having the browser say "In order to reload this page, information must be resent" or something similar to that? Form action is currently being handled by onsubmit= instead.
Upvotes: 1
Views: 1699
Reputation: 66231
It seems you are handling your form with an AJAX request in the onsubmit
event, which begs the question why since nothing is gained if you have to refresh the page anyway. I would suggest either using a normal post from the form, or use @Bob 's solution (which he saved me from typing by posting first). If you use window.location=window.location
be sure to call it after whatever happens in your onsubmit
method has completed or you may introduce a race condition where it redirects before your onsubmit method has finished sending the data.
Edit:
Just read your comment that provided more information. Again, reloading the whole page in response to an AJAX submit completely defeats the purpose of using AJAX. You really should consider using a Javascript Library like jQuery to help you with this. Basically the pattern would be as follows:
Upvotes: 0
Reputation: 99824
If you just want to reload the page without submitting the form try window.location=window.location;
Upvotes: 1
Reputation: 113
Reload will always ask the question about information being resent if the user came from POSTing data. It's hard to answer anything specific as I don't know what you are trying to do. This is something that is in the browser's history and can't be prevented.
A better solution is to use the PRG pattern.
http://en.wikipedia.org/wiki/Post/Redirect/Get
Upvotes: 1