Php 莫代尔没有接近请检查我的代码

Php 莫代尔没有接近请检查我的代码,php,jquery,bootstrap-modal,Php,Jquery,Bootstrap Modal,我正在使用下面的代码打印徽章信息,打印模式框未关闭 $("#printCnfWithoutLoginForm").formValidation({ framework: 'bootstrap', excluded: ':disabled', icon: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: '

我正在使用下面的代码打印徽章信息,打印模式框未关闭

$("#printCnfWithoutLoginForm").formValidation({
    framework: 'bootstrap',
    excluded: ':disabled',
    icon: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        emailAdressWLogin: {
            verbose: false,
            trigger: 'blur',
            validators: {
                notEmpty: {
                    message: 'Email is Required'
                },
                regexp: {
                    regexp: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9]{2,})+\.)+([a-zA-Z0-9]{2,4})+$/,
                    message: 'Please enter valid email address'
                },
                remote: {
                    type: 'POST',
                    url: '<?php echo get_site_url() ?>/wp-content/themes/mesocolumn/eventDetailsAjax.php/',
                    message: 'Sorry, You have not register for this event',
                    data: {
                        eventidWLogin: function () {
                            return $('#eventidWLogin').val()
                        },
                        eventtypeWLogin: function () {
                            return $('#eventtypeWLogin').val()
                        }
                    },
                }
            }
        }
    }
}).on('success.form.fv', function (e) {
            // Prevent form submission
            e.preventDefault();
            var $form = $(e.target),
                    fv = $form.data('formValidation');
            var data = $form.serialize();
            // Use Ajax to submit form data
            $.ajax({
                url: $form.attr('action'),
                type: 'POST',
                data: data,
                success: function (data) {
                    var printWindow = window.open('', '', 'height=400,width=800');
                    var is_chrome = Boolean(printWindow.chrome);
                    printWindow.document.write(data);
                    if (is_chrome) {
                        setTimeout(function () { // wait until all resources loaded 
                            printWindow.document.close(); // necessary for IE >= 10
                            printWindow.focus(); // necessary for IE >= 10
                            printWindow.print(); // change window to winPrint
                            printWindow.close(); // change window to winPrint
                        }, 400);
                    } else {
                        printWindow.document.close(); // necessary for IE >= 10
                        printWindow.focus(); // necessary for IE >= 10
                        printWindow.print();
                        printWindow.close();
                    }
  }
            });
            $('#autoUpdate2').modal('hide');
        });
$(“#printcnfwhithoutloginform”).formValidation({
框架:“bootstrap”,
已排除:':已禁用',
图标:{
有效:“glyphicon glyphicon ok”,
无效:“glyphicon glyphicon删除”,
正在验证:“glyphicon glyphicon刷新”
},
字段:{
EmailAddressWLogin:{
冗长:错,
触发器:“模糊”,
验证器:{
注意:{
信息:“需要电子邮件”
},
regexp:{
regexp:/^([a-zA-Z0-9\.\-])+\@([a-zA-Z0-9]{2,})+\)+([a-zA-Z0-9]{2,4})+$/,,
消息:“请输入有效的电子邮件地址”
},
远程:{
键入:“POST”,
url:“/wp content/themes/mesocolumn/eventDetailsAjax.php/”,
消息:“抱歉,您尚未注册此活动”,
数据:{
eventidWLogin:函数(){
返回$('#eventidWLogin').val()
},
eventtypeWLogin:函数(){
返回$('#eventtypeWLogin').val()
}
},
}
}
}
}
}).on('success.form.fv',函数(e){
//防止表格提交
e、 预防默认值();
变量$form=$(e.target),
fv=$form.data('formValidation');
var data=$form.serialize();
//使用Ajax提交表单数据
$.ajax({
url:$form.attr('action'),
键入:“POST”,
数据:数据,
成功:功能(数据){
var printWindow=window.open(“”,’高度=400,宽度=800’);
var是_chrome=Boolean(printWindow.chrome);
printWindow.document.write(数据);
如果(是铬){
setTimeout(函数(){//等待所有资源加载
printWindow.document.close();//IE>=10所需
printWindow.focus();//IE>=10所需
printWindow.print();//将窗口更改为winPrint
printWindow.close();//将窗口更改为winPrint
}, 400);
}否则{
printWindow.document.close();//IE>=10所需
printWindow.focus();//IE>=10所需
printWindow.print();
printWindow.close();
}
}
});
$('#autoUpdate2').modal('hide');
});

您可以手动调用
remove()
方法关闭模式

 $('body').removeClass('modal-open');
 $('.modal-backdrop').remove();

您可以手动调用
remove()
方法来关闭模式

 $('body').removeClass('modal-open');
 $('.modal-backdrop').remove();

这段代码工作正常,但我需要在关闭模式后单击两次才能再次打开。您可以做一件事,在ajax success$('yourID')中调用click函数;哇,对我来说很好谢谢你的帮助。。但我仍然感到困惑,为什么它可能与您的代码,而不是与此代码$('autoUpdate2')。模态('hide');谷歌你会得到更多关于模态的想法。。。上帝保佑你;)这段代码工作正常,但我需要在关闭模式后单击两次才能再次打开。您可以做一件事,在ajax success$('yourID')中调用click函数;哇,对我来说很好谢谢你的帮助。。但我仍然感到困惑,为什么它可能与您的代码,而不是与此代码$('autoUpdate2')。模态('hide');谷歌你会得到更多关于模态的想法。。。上帝保佑你;)