为什么jQueryMobile重新加载对话框上的页面关闭? [英] Why is jQueryMobile reloading the page on dialog close?

查看:69
本文介绍了为什么jQueryMobile重新加载对话框上的页面关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码加载jQueryMobile对话框:

I load a jQueryMobile dialog using this code:

<a data-rel="dialog" href="/path/to/dialog?arg1=val1" data-theme="b" id="deleteButton" class="ui-btn-right home" data-direction="reverse" data-transition="slidedown">Delete</a>

我的对话框有两个按钮:

My dialog has two buttons:

<a data-role="button" href="/path/to/page/that/showed/dialog" id="deleteAddressButton" data-rel="back">Delete</a>
<a data-role="button" data-theme="a" href="/path/to/page/that/showed/dialog" data-rel="back">Cancel</a>

当我单击按钮时,对话框关闭,并返回到打开对话框的页面.但是,打开对话框的页面是通过ajax重新加载的,这似乎是不必要的,而且很麻烦.有谁知道为什么会这样吗?对话框是否可以不重新加载调用页面就可以关闭?

When I click the buttons the dialog closes and returns to the page that opened the dialog. However, the page that opened the dialogs is being reloaded via ajax, which seems unnecessary and is breaking things. Does anyone have any idea why this happening? Shouldn't the dialog just be able to close without reloading the calling page?

注意:仅当我最初转到其他页面时,才会重新加载呼叫页面,例如:

Note: The calling page is only reloaded if I originally go to a different page, for example:

主页->调用对话框的页面->对话框

Home page -> Page that calls dialog -> Dialog

当我先进入主页,然后进入调用对话框的页面时,会发生问题.如果我在调用对话框的页面上重新加载整个页面,然后打开并关闭对话框,则调用对话框的页面不会通过Ajax重新加载.

The problem happens when I go to home page first, then page that calls dialog. If I do a full page reload on Page that calls dialog and then open and close the dialog, the page that calls dialog is not reloaded via ajax.

这也在jQuery Mobile的文档站点上发生.要看到这个:

This is happening on jQuery Mobile's documentation site also. To see this:

  1. 转到 http://jquerymobile.com/demos/1.0.1/
  2. 导航到页面和对话框"
  3. 导航到对话框"
  4. 单击第一个打开对话框"按钮.
  5. 使用Firebug或类似工具观看Ajax调用.
  6. 使用任一按钮关闭对话框.
  7. 请注意,将触发Ajax调用以重新加载调用页面.
  1. Go to http://jquerymobile.com/demos/1.0.1/
  2. Navigate to "Pages & Dialogs"
  3. Navigate to "Dialogs"
  4. Click on the first "Open Dialog" button.
  5. Use Firebug or something similar to watch the Ajax calls.
  6. Close the dialog using either button.
  7. Notice that Ajax calls are fired to reload the calling page.

推荐答案

jQuery Mobile的网站也做同样的事情,因此它必须是默认行为.

jQuery Mobile's website does the same thing so it must be the default behavior.

这篇关于为什么jQueryMobile重新加载对话框上的页面关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆