更改 html 后的 jQuery AJAX 后退按钮
我知道有很多关于 jQuery + 后退按钮问题的问题,但似乎他们试图在单击浏览器后退/前进按钮时维护历史记录功能。
我的问题是,当单击后退/前进按钮时,如何加载受ajax影响的html页面?
例如,
- 在index.html 中,使用AJAX (jQuery.post()) 动态删除列表中的所有“div”元素。
- 按浏览器后退(或前进)按钮转到 newpage.html。
- 按浏览器前进(或后退)按钮再次转到index.html。
- 问题:html 页面包含已删除的“div”元素。
在步骤(3)之后我应该如何加载没有“div”元素的index.html?
我目前使用 jQuery 和 Django 作为后端。 谢谢!
I know there are many questions about jQuery + Back button issues, but it seems that they're trying to maintain history features when clicking the browser back/forward buttons.
My question is that when clicking the back/forward button, how can I load ajax-affected html page?
For example,
- In index.html, dynamically remove all "div" elements from the list using AJAX (jQuery.post()).
- Press the browser back(or forward) button to go to newpage.html.
- Press the browser forward(or back) button to go to index.html again.
- PROBLEM: the html page contains the deleted "div" elements.
How should I load index.html with no "div" elements after step (3)?
I'm currently using jQuery and Django as backend.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery 历史记录插件 对应用程序状态进行编码。请参阅他们的演示页面,了解如何执行您想要的操作的示例。
Use the jQuery history plugin to encode the application state. See their Demos page for examples of how to do what you want.