1

我在确认引导箱中有一个表单,我需要确定按钮使该表单的提交捕获此表单的返回。

这是我用于引导箱的代码

$.get(ruta,
        function(response) {
            bootbox.confirm(response, function(result){
                if(result){

                }
            });
});

这是我的表格:

<form class="form-horizontal" id="form" method="POST" action="{{ path ('nueva_pregunta_ajax')}}" {{ form_enctype(form) }} novalidate >

我正在使用像模板电机这样的树枝和像框架一样的 symfony2

4

1 回答 1

2

您应该为此使用对话框:

//define your post target
var url = '/example/post';
$.get(ruta,function(response) {
    bootbox.dialog({
        title:'Your fancy title',
        message:response,
        buttons:{
            cancel:{
                label: "Cancel",
               className: "btn-default",
            },
            submit:{
                label: "Submit",
                className: "btn-primary",
                callback: function() {
                    //post the data
                    $.post(url, $('#form').serialize(), function(data){
                        //do something
                    });
                }
            }
        }    
    });
});

像这样的东西应该工作

于 2014-05-21T21:30:50.340 回答