refresh page in POST and keep all parameters using javascript
how开发者_Python百科 can I refresh a page using javascript and keep all the parameters in the POST method?
location.reload();
Will do that, but if the current page is the direct response to a POST request then the user will get a browser dialogue confirming the re-POST before the page reloads.
If that's no good you would have to create a new <form>
element with method="post"
and action
pointing to the current URL. You would have to do this from the server-side to duplicate all the POSTed parameters as <input type="hidden">
(and file uploads can't be replicated).
Depending on what you are doing, you may be able to use the PRG model to stop most pages being POST responses, allowing you to refresh without prompting.
精彩评论