javascript - jQuery Mobile - 如何强制重新创建页面 - pagebeforecreate 事件

标签 javascript jquery json jquery-mobile

我有一个小型 jQuery 移动网站。

  • 都是单个 .html 文件
  • 它有一些编辑功能(查看、编辑、保存)
  • 全部适用于 ajax/json/web 服务

我的大部分页面都使用来自 web 服务的数据,通过 AJAX 和 JSON,所以我经常使用以下内容:

$(document).on( 'pagebeforecreate', '#monday', function() {

// do some stuff on before create, load data with AJAX

});

现在,我如何强制重新创建该页面(pagebeforecreate 事件)以便再次运行内部的 AJAX(从服务器获取最新数据)?

最佳答案

使用 pageBeforeShow 而不是 pageBeforeCreate

来自jqm documentation , 关于创建事件。

Note that these events will only fire once per "page", as opposed to the show/hide events, which fire every time a page is shown and hidden.

关于javascript - jQuery Mobile - 如何强制重新创建页面 - pagebeforecreate 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13569235/

相关文章:

javascript - 如何将焦点从 iframe 中移出?

javascript - 是否可以在 css 中按下并按住按钮触发事件?

javascript - 如何在 JavaScript 中获取外部元素值

asp.net - jQuery 并在回调中解析 JSON

java - 如何在 Java 中从 JSON 中提取 JSONArray 和 JSONObject

javascript - jQuery 单击事件显示 JSON 数组中的特定数据无法正常工作

jquery - 线性渐变动画输入和输出

json - 在跨多个索引查询的 Elasticsearch 中过滤 '_index'的方式与 '_type'相同

javascript - 从要在 D3 中使用的 JSON 文件访问 ids