Javascript 从 jquery 对话框刷新父页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1974499/
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
refresh parent page from jquery dialog
提问by Dejan.S
I want to refresh the parent page when I close my jQuery dialog.
我想在关闭 jQuery 对话框时刷新父页面。
this is the code I use for my dialog. I tried top.opener.locationbut it did not do nothing but put me on top of the page.
这是我用于对话框的代码。我试过了,top.opener.location但它什么也没做,只是把我放在了页面的顶部。
$("#dialog").dialog({
height: 700,
width: 600,
closeOnEscape: true,
title: 'View',
close: function(event, ui){
top.opener.location.reload(true);
}
}).dialog("open");
回答by Kobi
The jQuery dialog opens on the same page, not in a new window. So simple refresh the current page:
jQuery 对话框在同一页面上打开,而不是在新窗口中打开。如此简单的刷新当前页面:
location.reload(true);

