Pass value from iframe colorbox to parent page
Hello,
Some problem with passing values.
I have 3 pages :
home.php
iframe.php (that I display with overlay colorbox)
start.php (the url redirection after overlay closing)
In home.php i have my colorbox script :
- <script type="text/javascript">
$(document).ready(function(){
$(".iframe").colorbox({
iframe:true,
transition:"elastic",
scrolling: false,opacity:0.60,
width:"550px",
height:"300px",
onClosed:function(){
var name = $('#name').val();
location.href = 'start.php?name='+name;
}
});
});
</script>
And my html links to open the overlay :
- <a href="iframe.php" class="iframe">OPEN OVERLAY</a>
In Iframe.php I have this js script to close the overlay :
- <script type="text/javascript">
$(document).ready(function() {
$("#button_cancel").click(function() {
parent.$.colorbox.close();
return false;
})
});
</script>
And the html code, my form :
- <form action="javascript:parent.$.colorbox.close()">
<input type="text" id="name" value="" />
<input value="Submit" type="button" />
</form>
When I open the overlay, I would like to enter on the input some text and when I clic on close button, pass the inputtext value on my parent page and go to the start.php?myvalue=name
Thank you for your help