当我们尝试重新加载或刷新任何框架时如何避免弹出
有时有一帧包括加载动作类。但有时由于服务器问题或其他一些原因。
在这种情况下,我想重新加载脚本。
但是,在重新加载脚本时,我会弹出“重新发送数据”之类的消息。并要求确认。
重新加载脚本时如何避免弹出窗口?
注意:由于我需要获取超过1KB的数据(可能会扩展),所以我只需要使用POST请求。 这有什么意义吗?
There is one frame sometimes which includes to load action class. But sometimes due to server issues or some other causes.
In this scenario, I want to reload the script.
But, while reloading the script, I am getting as a pop up like "resending data". and asking confirmation.
How to avoid pop ups while reloading the script?
Note: As I need to get more than 1KB data(it may extend), I need to use POST request only.
Will it make any sense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在页面加载后立即使用 ajax 将 post 请求异步发送到服务器。
在这种情况下,出现问题时您无需刷新页面。只需使用 Javascript 重新发送 post 请求即可。而且即使您刷新页面,浏览器也不会弹出警告对话框。
You can use ajax to send the post request to server asynchronously, right after the page has been loaded.
In that case, you don't need to refresh your page when there's something wrong. Just simply resend the post request with Javascript. And the browser won't pop up a warning dialog if you refresh the page anyway.
看来您输入带有发布请求的站点,将其更改为获取,然后“重新加载它”。
It seems that you enter the site with a post requset, change it to a get and just "reload it".
如果您有权访问服务器代码,并且解决方案允许,则可以在处理 POST 后重定向到相同的 url。然后您可以进行刷新,无需 POST 和确认。
建议使用 su27 建议的 ajax,这是一个更好的解决方案,但可能更难实现......
If you have access to the server code, and the solution allows it, you can do a redirect to the same url after handling the POST. Then you can do a refresh without POST and confirmation.
Using ajax as suggested by su27 is recommended and a far better solution, but will probably harder to implement...