简体   繁体   中英

jQuery AJAX back button after changing html

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,

  1. In index.html, dynamically remove all "div" elements from the list using AJAX (jQuery.post()).
  2. Press the browser back(or forward) button to go to newpage.html.
  3. Press the browser forward(or back) button to go to index.html again.
  4. 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!

Use the jQuery history plugin to encode the application state. See their Demos page for examples of how to do what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM