I'm using jQuery ColorBox
to display a shopping cart item. When a user enters the quantity in the iFrame (opened with colorbox) and clicks on the submit button, I want the iFrame to be close and main window (parent) to be refreshed automatically.
I mean I want two things after submitting data on iFrame:
- iFrame closes automatically.
- Parent window getting refresh automatically.
Please help me out.
If you're using Drupal 7, you may need to use the following alternative:
In D7, the $.fn seems to be replaced by the jQuery object.
I simply setup a menu callback which simply returned this:
Seemed to work fine for me :)
use this on the parent window while opening iframe:
and this to close the iframe inside iframe page:
If you want to stay on current page :
write the following code on parent page where colorbox is applied.
and the following code on your current page where you want to close colorbox
parent.$.fn.colorbox.close();
Note: please replace
.tu_iframe_800x600
with your html class on which the colorbox is called...