JQM动态弹出窗口

I have a form in which on clicking submit button the form data is sent through ajax and the related message may it be error or confirmation details from the server script which has been written in php is displayed . For now every thing is working fine . But what I want to know is that the message whcih is being displayed with help of JS can I change it into JQM popup as I am using JQM 1.4.2 for my design .

Popup

<div data-role="popup" id="mDialog" data-overlay-theme="a" data-theme="c" style="max-width:400px;" class="ui-corner-all">
                <div data-role="header" data-theme="a" class="ui-corner-top">
                  <h1>Attention!!</h1>
                </div>
                <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
                  <h3 class="ui-title">{Are you sure you want to delete this page?</h3>
                  <p>This action cannot be undone.}  <?php if($this->error->description!='')echo trim($this->error->description)?> </p>
                  <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a>    
                  <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Delete</a>  
                </div>
            </div>

Thanks in advance

1个回答

Try this;

Put this in your HTML, above your <form>

<div id="formNotice"><img src="loading.gif" alt="Loading" /></div>

Now put this where you handle the AJAX response

$("#formNotice").html(AJAXResponse);
$("#formNotice").popup("open");

Here's the docs

Jsfiddle (Without JQM - but you get the idea)

duanlvxi8652
duanlvxi8652 使用脚本更新了我的问题并且错误即将发生,因为我没有初始化div,因为popup是使用$(“#mDialog”)解决的.popup(); $( “#支持mDialog”)弹出( “开放”)。
6 年多之前 回复
doujiao4705
doujiao4705 我不确定你的意思是“回去或删除”:/
6 年多之前 回复
dongshuxi3105
dongshuxi3105 谢谢兄弟我在我的桌面版本中一直在做这样的事情,当你点击提交时用Jquery加载一个图像。 此外,我试图使这个弹出窗口看起来像一个页面可能有两个按钮返回或删除..我在脚本中得到一个错误的人错误:无法在初始化之前调用弹出窗口上的方法; 试图调用方法'打开'
6 年多之前 回复
dopq87915
dopq87915 更新的帖子:)
6 年多之前 回复
dqblm40280
dqblm40280 如何在显示错误之前添加加载图像?
6 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐