jquery - colorbox.close Firebug 错误

标签 jquery colorbox

我在 colorbox iframe 中有一个表单:

$(".contact_usModal").colorbox({iframe:true, innerWidth:670, innerHeight:515});

我使用上面的内容来触发链接,并且颜色框可以正常打开。

然后我想在单击提交按钮并发布数据时关闭颜色框。 但这就是棘手的地方,因为我设置的验证器和 ajax 帖子在某种程度上干扰了表单提交时颜色框的自动关闭。

SubmittingForm=function() { //  form validetd now do the following

var txt = $.ajax({
url: "process.php",
async: true,
type:'POST',
data:({
name:$('input#name').val(),  
email:$('input#email').val()
})  

}).success; 

    // I have tried both options below - they are taken from the colorbox javascript file.

    // Usage format: $.fn.colorbox.close();
    // Usage from within an iframe: parent.$.fn.colorbox.close();

$.fn.colorbox.close();
parent.$.fn.colorbox.close();

        }

        $(document).ready(function() {
            $("#myform").validate({
                submitHandler:function(form) {
                    SubmittingForm();
                },
                rules: {
                    name: "required",
                    email: {            
                        required: true,
                        email: true
                    },

                    },

            });
        });

另外请注意,我在 firebug 中收到此错误:

http://witnessemcee.com 的权限被拒绝从 http://www.witnessemcee.com 获取属性 Window.$ 。父级.$.fn.colorbox.close();

谢谢。

约翰

最佳答案

Both comments from you guys worked! It was a subdomain issue as well as a code issue. Here is what i did.

Made my domain redirect to show no www in the address bar, using cpanel but can be done with .htaccess direct.

Also i used this code for the color box close and it worked.

parent.$.fn.colorbox.close()

(摘自OP编辑的问题)

关于jquery - colorbox.close Firebug 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4690357/

相关文章:

javascript - 颜色框删除框架箭头导航

javascript - 颜色框和图像调整大小

jquery - OnClick 的复选框选择行并在按钮单击时打开行并使用现有数据

javascript - 将div添加到html和数组中,如果删除,则需要将它们从html和数组中删除

javascript - 多次 AJAX 调用出现错误

javascript - ColorBox "CLick to CLose"- 不可见 -#FFF 文本?

jQuery 颜色框 : How can I change the position of the colorbox

javascript - 如何在彩盒中打开网页?

jquery - 使用 .first() 和 .eq(0) 有什么区别?

javascript - 使用 jQuery 更改图像 src onClick