开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜