Javascript 如何关闭彩盒?

Javascript 如何关闭彩盒?,javascript,jquery,colorbox,Javascript,Jquery,Colorbox,您好,单击时我有一个链接打开一个彩色框,其中包含一个表单我想要的是,当我单击submit按钮时,表单将通过ajax提交,并基于返回的数据 if(error on the server side){ the error will be displayed at the top of the form; // colorbox still open }else{ the returned data will be displayed on the original page;

您好,单击时我有一个链接打开一个彩色框,其中包含一个表单我想要的是,当我单击submit按钮时,表单将通过ajax提交,并基于返回的数据

 if(error on the server side){
   the error will be displayed at the top of the form;
   // colorbox still open
 }else{
   the returned data will be displayed on the original page;
   close the colorbox;
 }
所以我做了所有这些,除了关闭色盒部分,我使用了以下代码:

$.colorbox.close();
这也不管用:

parent.jQuery.colorbox.close();

任何帮助,请提前通知thanx。

不久前有过这个,我记不起是哪一个了

试试这个

$(window).colorbox.close();
或者这个

jQuery(window).colorbox.close();
jQuery('#cboxClose').click();
或者这个

jQuery(window).colorbox.close();
jQuery('#cboxClose').click();