【问题标题】:Submit function after Confirm popup确认弹窗后提交功能
【发布时间】:2014-09-24 11:28:06
【问题描述】:

我想要一个确认弹出窗口,我可以在提交活动之前使用“确定”或“取消”,但我无法管理它。

这是我的代码,谢谢你的帮助!

$('#display_events_form').submit(function() {
            var data="eventid="+eventid+"&person="+globe_search_general_person;

            $.post('join_event.php', data,  function(response){

                  $.each(response, function(index) {

                      $('<p align="left">Eventname: ' + response[index].name +
                        '<br>Datum / Uhrzeit: ' + response[index].startdate +
                        '<br>Ersparnis: ' + response[index].saving + ' EUR'+
                        '<br>Treffpunkt: ' + response[index].meetingpoint + '</p>')
                        .appendTo("#join_event_response_event_details");

                        //display_events_form
                    });

            },'json');

            $.mobile.pageContainer.pagecontainer("change", "#join_event_response", {transition: "slide"});
            return false;
        });

【问题讨论】:

    标签: jquery jquery-mobile submit confirm


    【解决方案1】:

    @user3791330,在$.post() 之前,您可以按照自己的意愿使用以下代码

    if(!confirm("__YOUR MSG GOES HERE____")){
       return false; 
    }    
    

    或者你可以这样测试

    $(document).ready(function(){
        if(!confirm("Are you sure to countinue ?")){
            return false;
        }
        alert("Hi,I m on the way !!");    
    });
    

    【讨论】:

    • 嗨,谢谢第一个完美的作品。是否可以设置弹出窗口的样式?不想将互联网地址作为标题。
    • 您无法将样式添加到 javascript 弹出窗口 (confirm())。您应该使用 jquery 模型或其他模型插件..
    • 如果我使用 jquery 移动插件,我必须如何更改代码?
    猜你喜欢
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-28
    • 1970-01-01
    相关资源
    最近更新 更多