简体   繁体   English

弹出ajax成功

[英]Pop up on ajax success

I have this modal pop up when a link is clicked. 单击链接后,我会弹出此模式对话框。 It has a text area and 2 buttons: Send and cancel 它具有一个文本区域和2个按钮:发送和取消

   <a href="#message" style="text-decoration:none" class="common2 simple3" >Message</a>
        <div id="message" class="modalDialog">
                <div>
                    <!---<a href="#close" title="Close" class="close">X</a>--->
                    <h3>Create A Message</h3>


                    <textarea  id = 'msgContent' cols="48" rows="10" ></textarea>
                    <br>
                    <div id="create_btn">
                        <a href="#" id = 'send' class="common simple2" style='margin-left:50px;text-decoration: none;'>Send</a>
                    </div>
                    <div id="cancel_btn">
                        <a href="#close" class="common simple2" style='margin-left:40px;text-decoration: none;'>cancel</a>
                    </div>
                    <br>
                    <br>
                </div>
        </div>
        <div id="success" class="modalDialog">
                <div>
                    <h3>Message sent</h3>
                    <div id="cancel_btn">
                        <a href="#close" class="common simple2" style='margin-left:40px;text-decoration: none;'>OK</a>
                    </div>
                </div>
        </div>

and i have this code in ajax success when the send button is clicked 当单击发送按钮时,我在ajax成功中拥有此代码

  success: function(result)
                        {                                           

                            if (result == true)
                            $( "#success" ).dialog( "" );

                        } 

I am working on showing another pop up when the ajax is successful. 我正在尝试在ajax成功时显示另一个弹出窗口。 But I have no idea how to call 但是我不知道怎么打电话

  <div id="success" class="modalDialog">     

What you do is check if ajax call is success by keeping an alert in it. 您要做的是通过在其中保持警报来检查ajax调用是否成功。

success: function(result){                                           
      if (result == true)
        alert('working');
      else 
        alert('not working');

} }

if your alert i 'working' then check if you are including jqueryui https://jqueryui.com/dialog/ 如果您的警报“有效”,请检查是否包含jqueryui https://jqueryui.com/dialog/

dialog() is a jquery ui function not a javascript predefine function. dialog()是一个jQuery ui函数,而不是javascript预定义函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM