Load dynamic data in dialog box of jquerymobile
I am trying to load data from server in dialog box of jquerymobile.
I open dialog box using
<a href="menu.htm" data-rel="dialog" data-transition="slideup" >Menu</a>
and menu.htm file contains following code :
<div data-role="page" id="men">
<div data-position="inline" data-theme="d" data-role="header" class="ui-corner-top ui-overlay-shadow ui-bar-d ui-header" role="banner">
<a data-iconpos="notext" data-rel="back" data-icon="delete" href="#" class="ui-btn-left ui-btn ui-btn-icon-notext ui-btn-corner-all ui-shadow ui-btn-up-d" title="Close" data-theme="d"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Close</span><span class="ui-icon ui-icon-de开发者_如何学Pythonlete ui-icon-shadow"></span></span></a>
<h1 class="ui-title" tabindex="0" role="heading" aria-level="1">Dialog</h1>
</div>
<div data-role="content" data-theme="e" id="menus">
<p>
This is a regular page, styled as a dialog. To create a dialog, just link to a normal page and include a transition and
<code>
data-rel="dialog"
</code>
attribute.
</p>
<a href="index.html#page5" data-role="button" data-theme="a">Good for you</a>
<a href="docs-dialogs.html" data-role="button" data-rel="back" data-theme="c">Don't care, really</a>
</div>
</div>
I included js file and added following code that js :
$('div[id="men"]').live("pageshow", function(){
alert("loaded");
});
But it does not showing me the alert.
Please help me
Thanks
Move the included js file and following code to the main script (not menu.htm) and not the dialog:
$('div[id="men"]').live("pageshow", function(){
alert("loaded");
});
精彩评论