I'm building an little mobile app and I got a question about JQM.

我正在开发一个移动应用程序,我有一个关于JQM的问题。

When the user is logged in the user will be redirected to page A. Page A is loaded with the loadPage from JQM (example: $.mobile.loadPage("pageA.html"))

当用户登录时,将被重定向到A页。页面A装载了来自JQM的loadPage(例如:$. mobiley .loadPage(“page .html”))

After the page is loaded, I do an AJAX-call because I pull some data from a database and change the content on page A. From page A, I can go to page B. page B has an back-button. When I click on the back-button, the app slides back to the state without the AJAX content. Is there a way to fix this?

加载页面后,我进行ajax调用,因为我从数据库中提取一些数据,并更改页面a上的内容。当我单击back按钮时,应用程序就会滑回到没有AJAX内容的状态。有办法解决这个问题吗?

Thanks

谢谢

1 个解决方案

#1


7

By default, jQuery Mobile will remove any page brought into the DOM via AJAX once the user navigates away from the page. If you want to disable this feature for a specific page you can add the data-dom-cache attribute to the data-role="page element for the page and set it to true:

默认情况下,jQuery Mobile将在用户离开页面后,通过AJAX删除任何进入DOM的页面。如果您想要禁用特定页面的此特性,可以将data-dom-cache属性添加到页面的data-role="page element,并将其设置为true:

<div data-dom-cache="true" data-role="page" id="pageA">
    ...
</div>

Source: http://jquerymobile.com/demos/1.1.0-rc.1/docs/pages/page-cache.html

来源:http://jquerymobile.com/demos/1.1.0-rc.1/docs/pages/page-cache.html

This feature was added to jQuery Mobile to help control the size of the DOM so less browser crashes will occur. If you just want to keep a single page in the DOM then make sure it's not a huge page that will bog-down the device.

这个特性被添加到jQuery Mobile以帮助控制DOM的大小,从而减少浏览器崩溃的发生。如果您只想在DOM中保留一个页面,那么请确保它不是一个会使设备陷入困境的大页面。

更多相关文章

  1. jquery 触发a标签点击事件,弹出页面
  2. 如何在jQuery Datatables分页中返回特定页面?
  3. jQuery File Upload 单页面多实例的实现
  4. 如何使用CSS将表放在页面的中心?
  5. 如何在HTML中为移动页面创建图像下载链接?
  6. html 页面内锚点定位及跳转方法总结
  7. xml格式原样输出到html或是jsp页面
  8. HTML5-Service Worker实现离线页面访问
  9. Html5如何使我们开发出来的应用或页面大小能适合各种高端手机使

随机推荐

  1. [Android] TextView的垂直滚动效果
  2. android native c development
  3. 跑马灯效果:
  4. Android 限制EditText只能输入数字、限制
  5. 关于Android软键盘弹出,会把原来的界面挤
  6. Android SDK相关问题
  7. Android xml资源文件中@、@android:type
  8. 让star也具有CheckBox 功能
  9. android程序在Layout中设置控件水平或垂
  10. Android TextView 文字居中