![](/img/trans.png)
[英]want to redirect to another page from colorbox iframe after closing it
[英]Redirect to another page from colorbox
我有一个颜色框。 使用php验证某些值后,我想重定向到另一个页面。 我已经尝试了以下代码
if (isset($_POST['confirm'])) {
echo "<script>
parent.$(document).bind('cbox_closed', function(){
window.location.href = 'paypal.php';
}); parent.$.fn.colorbox.close(); </script>";
}
但这令人耳目一新。 我找不到错误。 谁能告诉我我该怎么做。
使用window.top到达最顶部的窗口,否则您将只重新加载iframe:
if(isset($_POST['confirm'])){
echo "<script>
parent.$(document).bind('cbox_closed', function(){
window.top.location.href = 'paypal.php';
}); parent.$.fn.colorbox.close(); </script>";
}
我建议使用heredoc进行回显,因为PHP在双引号中处理“ $”。 而且它应该是脚本的状态类型- <script type="text/javascript">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.