如何使用 jQuery 验证方法的 "submit handler" 在表单提交上显示 bootstrap 模态 Window?

How to show a bootstrap Modal Window on form submit using "submit handler" of jQuery Validate method?

我有一个表单,正在使用 .validate 方法验证字段和提交表单。我想在提交时显示 Bootstrap 模态 Window。有人可以帮助我实现这一目标吗?这是代码:

<form action="" method="post" id="registration" novalidate="novalidate" enctype="plain/text">

...

</form>

<div class="modal hide" id="myModal" data-backdrop="false">  
     <div class="modal-dialog">
        <div class="modal-content">      
          <div class="modal-body">

             ... Modal Window Content.. 

          </div>          
        </div>      
      </div>
</div>

$("#registration").validate({

        rules: {
            .....
        },

        messages: {
            ......
        },

        submitHandler: function(form){
            //alert("Thank you for registration..!");           
            form.submit();
        }

    }); 

您必须在异步请求中提交表单,并在成功时显示模式。例如

$("#registration").validate({

    rules: {
        .....
    },

    messages: {
        ......
    },

    submitHandler: function(form){
        $.ajax({
            url: $(form).action,
            method: $(form).method,
            data: $(form).serialize(),
            success: function() {
               $("#myModal").modal("show");
            }
        })
    }

});