colorbox.close Firebug Error
I have a form inside a colorbox iframe:
$(".contact_usModal").colorbox({iframe:true, innerWidth:670, innerHeight:515});
I use the above to trigger the link and the colorbox opens fine.
I then want to close the colorbox on submit button clicked and data Posted. But this is where its tricky because the validator and ajax post i have set up is somehow interfering with the automatic closing of the colorbox on form submit.
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
},
},
});
});
Also just to note, i get this error in firebug:
Permission denied for http://witnessemcee.com to get property Window.$ from htt开发者_JAVA百科p://www.witnessemcee.com. parent.$.fn.colorbox.close();
Thank you.
John
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()
(Extracted from edited question by OP)
精彩评论