重定向父页面上里面的fancybox提交指定的网址 [英] Redirect parent page to specified url on Submit inside fancybox
问题描述
我使用的fancybox和submiting我的表单后,我想我的redirtect父页面的一些指定的网址我使用的fancybox如下
i am using fancybox and after submiting my form i want to redirtect my parent page to some specified url i am using fancybox as below
$(document).ready(function () {
$('[id*=addnewRequest]').fancybox({
'width': 760,
'height': 540,
'padding': 0,
'margin': 0,
'hideOnOverlayClick': false,
'scrolling': 'auto',
'autoScale': false,
'transitionIn': 'none',
'transitionOut': 'none',
'type': 'iframe',
'centerOnScroll': true,
'onClosed': function () {
if ($.redirTo != null && $.redirTo.length > 0){
window.location.replace($.redirTo);
}
else {
parent.location.reload(true);
}
}
});
});
和submiting我的表格后,我使用下面的脚本寄存器其中redirectTo'是URL,我想我的父页面重定向
and after submiting my form i am using below register script where 'redirectTo' is url where i want my parent page will redirect
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "add", "parent.jQuery.redirTo='" + redirectTo + "'; parent.jQuery.fancybox.close();", true);
现在怎么我的父页面重定向到perticular url.Any想法?
Now how my parent page will redirect to perticular url.Any idea?
感谢,
推荐答案
submiting表单可以直接用新的URL拨打 window.top.location.href
之后如:
After submiting your form you can direct call the window.top.location.href
with the new url as:
window.top.location.href = "http://www.urltogo.com/pagetomove.aspx";
和避免父发送参数,并从那里进行重定向。
and avoid to send parameters on the parent and from there make the redirect.
下面是一个例子(我加5秒的延迟有时间看看吧)
Here is an example (I add 5 second delay to have the time to see it)
http://jsfiddle.net/u6whQ/3/ 或的 http://jsfiddle.net/u6whQ/4/
您行很可能会为:
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "add", "window.top.location.href ='" + redirectTo + "'; parent.jQuery.fancybox.close();", true);
这篇关于重定向父页面上里面的fancybox提交指定的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!