Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery iFrame Colorbox内的表单验证,如何在父页面中打开href URL并关闭Colorbox。_Jquery_Validation_Colorbox - Fatal编程技术网

Jquery iFrame Colorbox内的表单验证,如何在父页面中打开href URL并关闭Colorbox。

Jquery iFrame Colorbox内的表单验证,如何在父页面中打开href URL并关闭Colorbox。,jquery,validation,colorbox,Jquery,Validation,Colorbox,我在这上面花了太多的时间,但还是不明白。当表单通过验证时,尝试将表单提交页面从打开到parents.page。这就是我们到目前为止所得到的,它完成了任务,但我不喜欢我们必须将window.parent.location.href=/page1.hmtl。。。从技术上讲,他们并没有真正提交表格。此代码位于正在调用的iframe颜色框中 $(document).ready(function() { $("#formResultQuote").validate({ rules: {

我在这上面花了太多的时间,但还是不明白。当表单通过验证时,尝试将表单提交页面从打开到parents.page。这就是我们到目前为止所得到的,它完成了任务,但我不喜欢我们必须将window.parent.location.href=/page1.hmtl。。。从技术上讲,他们并没有真正提交表格。此代码位于正在调用的iframe颜色框中

$(document).ready(function() {
$("#formResultQuote").validate({
          rules: {
              rqResult: {
                  required: true,
                  minlength:1
              }
          },
          messages: {
              rqResult: {
                  required: 'Please select one of the saved quotes.'
              }
          },
          errorPlacement: function (error, element) {
              if (element.attr('name') == 'rqResult') {
              error.appendTo(element.parents().find('.rqResultError'));
          parent.$.colorbox.resize({height:580});
          },
         submitHandler: function() {
         if ($('#formResultQuote').valid()) {
         parent.jQuery.colorbox.close();
         window.parent.location.href="/page1.hmtl";
         }
       }                  
    });
});
此页面上的基本HTML非常类似于以下内容:

<form name="formResultQuote" id="formResultQuote" action="/page1.html" method="post">

<input name="rqResult" id="core" type="radio" class="radioCircle" validate="required:true, minlength:2"/>
<input name="rqResult" id="core" type="radio" class="radioCircle"/></div>
<input name="rqResult" id="core" type="radio" class="radioCircle"/></div>

<input type="submit" value="Retrieve your quote." id="regularSubmitBtn" name="Retrieve_a_Quote" tabindex="27" class="rqSubmitBtn" >
</form>
与此相反:

parent.jQuery.colorbox.close();
window.parent.location.href="/page1.hmtl";
你可以试试这个:

parent.jQuery('document').bind('cbox_closed', function(){
    location.href="/page1.hmtl";
});
parent.jQuery.colorbox.close();