Reputation: 1171
I have a colorbox. I want to redirect to another page after validating some value using php. I have tried the below code
if (isset($_POST['confirm'])) {
echo "<script>
parent.$(document).bind('cbox_closed', function(){
window.location.href = 'paypal.php';
}); parent.$.fn.colorbox.close(); </script>";
}
But it is refreshing this iframe. I cant find the error. Could anyone tell me how i can do this.
Upvotes: 1
Views: 770
Reputation: 1320
I suggest using heredoc for echo, because PHP processes '$' in double quotes.
Also it should be state type of script - <script type="text/javascript">
Upvotes: 0
Reputation: 2400
Use window.top to reach the topmost window otherwise you will only reload the iframe:
if(isset($_POST['confirm'])){
echo "<script>
parent.$(document).bind('cbox_closed', function(){
window.top.location.href = 'paypal.php';
}); parent.$.fn.colorbox.close(); </script>";
}
Upvotes: 2