jQuery 关闭厚框窗口后刷新父窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2539784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:44:14  来源:igfitidea点击:

refresh parent window after closing thickbox window

jqueryhtmlformsthickbox

提问by Brad

I am using Thickbox 3.1 for a login form, using the iframe version.

我正在使用 Thinbox 3.1 作为登录表单,使用 iframe 版本。

I want to close the iframe (child) window, then refresh the parent window.

我想关闭 iframe(子)窗口,然后刷新父窗口。

This closes the iframe window, but I need to somehow set it to refresh the parent window

这将关闭 iframe 窗口,但我需要以某种方式将其设置为刷新父窗口

<a href="#" onclick="self.parent.tb_remove();">Close</a>

Any help is appreciated.

任何帮助表示赞赏。

回答by RichieHindle

This should do it:

这应该这样做:

<a href="#" onclick="self.parent.tb_remove(); window.location.reload()">Close</a>

Edit:Maybe that should be:

编辑:也许应该是:

self.parent.location.reload()

?

?

回答by John

try

尝试

<a href="#" onClick="parent.location.reload(1)">Close</a>

worked for me

为我工作

回答by Nicky the Hutt

Bear in mind that whatever your page is doing isn't instantaneous. For my site I set new values in a table (MySQL) and I had to add a timeout.

请记住,无论您的页面在做什么,都不是即时的。对于我的站点,我在表 (MySQL) 中设置了新值,并且必须添加超时。

I had to do: setTimeout(function(){parent.location.reload(1)},1000)

我不得不这样做: setTimeout(function(){parent.location.reload(1)},1000)

Also used this modification to the .js file: http://designerfoo.com/jquery-thickbox-hack-to-refresh-parent-window-on-tb_close-event.html

还对 .js 文件使用了此修改:http: //designerfoo.com/jquery-thickbox-hack-to-refresh-parent-window-on-tb_close-event.html

回答by Justin Ethier

How about:

怎么样:

self.parent.location = "page_to_reload";