Javascript 提交带有jquery确认的表单

Javascript 提交带有jquery确认的表单,javascript,jquery,Javascript,Jquery,我使用Jquery确认插件,但如果我单击“确认”按钮,我对如何提交表单感到困惑。这是我的密码: $(函数(){ $(“按钮[name='btn-delete-akun'])。确认({ 标题:“Peringatan!”, 内容:“阿帕卡·安达·雅金在孟哈布斯事件中?”, useBootstrap:没错, 按钮:{ 确认:{ btn类:“btn红色”, //如果单击此确认按钮,如何提交表单 }, 取消:函数(){} } }); }); 谢谢。你试过这个吗 buttons: {

我使用Jquery确认插件,但如果我单击“确认”按钮,我对如何提交表单感到困惑。这是我的密码:

$(函数(){
$(“按钮[name='btn-delete-akun'])。确认({
标题:“

Peringatan!”, 内容:“阿帕卡·安达·雅金在孟哈布斯事件中?”, useBootstrap:没错, 按钮:{ 确认:{ btn类:“btn红色”, //如果单击此确认按钮,如何提交表单 }, 取消:函数(){} } }); });

谢谢。

你试过这个吗

buttons: {
              Yes: function () {$('#yourForm').submit()},
              No: function () {}
            }

我认为这个例子将有助于尝试这个

$.confirm({
    title: 'Prompt!',
    content: '' +
    '<form action="" class="formName">' +
    '<div class="form-group">' +
    '<label>Enter something here</label>' +
    '<input type="text" placeholder="Your name" class="name form-control" required />' +
    '</div>' +
    '</form>',
    buttons: {
        formSubmit: {
            text: 'Submit',
            btnClass: 'btn-blue',
            action: function () {
                var name = this.$content.find('.name').val();
                if(!name){
                    $.alert('provide a valid name');
                    return false;
                }
                $.alert('Your name is ' + name);
            }
        },
        cancel: function () {
            //close
        },
    },
    onContentReady: function () {
        // bind to events
        var jc = this;
        this.$content.find('form').on('submit', function (e) {
            // if the user submits the form by pressing enter in the field.
            e.preventDefault();
            jc.$$formSubmit.trigger('click'); // reference the button and click it
        });
    }
}); 

您还可以在formSubmit操作中编写ajax方法。

$(“#yourForm”).submit()
假设表单中没有name或id=“submit”的内容共享表单代码,以便正确识别问题it not works@RoryMcCrossan Delete我想将表单发送到server@Hendra请为运行中的服务器()使用$.ajax({})方法({}方法。@HendraFeb在操作方法$.ajax中使用此脚本({type:'post',data:data,dataType:'json',url:ctx+“/cardbininfo/delById”,success:function(response){//logic here});
$.confirm({
        title: 'Are you sure you want to approve this application?',
        content: '',
        buttons: {
            confirm: function () {

                $.ajax({
                    url: 'myUrl',
                    type: "POST",
                    data: {
                        // data stuff here
                    },
                    success: function () {
                        // does some stuff here...
                    }
                }),
            cancel: function () {

            }
        }
    }
    });