【发布时间】:2015-07-27 14:05:42
【问题描述】:
在父 html 页面中,当我单击链接时,fancybox 对话框打开,我在该 fancybox 中加载了一个 laravel php 视图页面。
当我在fancybox对话框中按下“使用twitter登录”按钮时,我想关闭fancybox并重定向到路由(登录/推特)
当我在fancybox 对话框中按下“用facebook 登录”按钮时,我想关闭fancybox 并重定向到一个路由(登录/facebook)。
要知道路由到哪里,我需要知道在 afterClose 回调函数中点击的是哪个按钮。
//parent.php
$(".myDiag").fancybox({
width : 900,
height : 600,
maxWidth :"95%",
padding : 0,
fitToView : false,
autoSize : true,
autoScale : true,
autoDimensions: true,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
afterClose : function(signupSource)
{
if(signupSource)
{
window.location = "<?php echo route('login'); ?>" + "/" + signupSource;
}
}
});
//js in Fancybox.php
$('#loginWithTwitter').click(funciton(){
parent.$.fancybox.close('twitter'); // 'twitter' is not getting sent to the afterClose callback function
});
如何将 Fancybox.php 中的 signupSource 传递给 parent.php?
【问题讨论】:
标签: javascript jquery html laravel fancybox-2