How do i shut fancybox iframe after a submit
I have an iframe on siteB with has a from from siteA when the user on siteB clicks on the开发者_开发百科 submit
<input type="submit" value="Save url" name="commit" method="post" id="url_submit">
I need the lightbox to close
i tried adding
$('#url_submit').click(function(){
$.fn.fancybox.close();
});
to both sites and nothing and i am sort of confused
First off, are siteA and siteB under the same domain? If so, you can try
window.parent.jQuery.fn.fancybox.close();
But if they're not, you'll have to create a callback url that closes your fancybox, and when your form is submitted redirect to this url.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function () {
window.parent.jQuery.fn.fancybox.close();
});
</script>
</body>
</html>
Try this:
parent.$.fancybox.close();
Figured a great solution that is really clean added
TARGET="_top"
and it closed after submission
Little confused by your question. Can you open firebug and do $.fn.fancybox.close();
?
精彩评论