Ajax更新了用户界面和后退按钮

UpT*_*eek 6 ajax jquery user-interface

场景:

  • 页面上加载了复杂的UI.
  • 用户执行一些通过Ajax回调改变数据的操作,通过DOM操作(例如通过jQuery)在UI上反映更改.
  • 用户单击链接转到另一个页面(比如详细信息页面).
  • 用户单击后退按钮返回到原始UI页面.
  • 用户看到过时的信息 - 看起来他所做的更改(在步骤2中)从未发生过.

你是如何处理这种情况的?

小智 2

饼干。用户离开页面并返回后保存信息的唯一方法是使用 cookie。

更好的方法是

0. user goes to your page 
1. A page is loaded with complex UI based on what is saved in the users cookies (default if no cookie)
2. user does some actions, which are saved into the cookie
3. user goes to another page
Run Code Online (Sandbox Code Playgroud)