【问题标题】:Submit a form inside of a bootbox在引导箱内提交表单
【发布时间】:2014-05-12 16:58:21
【问题描述】:

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

这是我用于 bootbox 的代码

$.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

【问题讨论】:

  • 挤压我,我已经更新了问题,对不起

标签: jquery forms symfony twig bootbox


【解决方案1】:

你应该为此使用一个对话框:

//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
                    });
                }
            }
        }    
    });
});

类似的东西应该可以工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多