[英]AngularJS controller success, window.location not closing modal or refreshing page
[英]Refreshing the main page after closing a modal window
在给定的网页上,我有一个链接,该链接使用Thinbox打开模式窗口。 在该窗口中,我有一个用来保存一些数据的表格。 提交表单后,我关闭模式窗口。 现在我的问题是:关闭模态窗口后是否可以刷新主页?
谢谢。
在提交表单之后且关闭窗口之前调用此方法:
window.opener.location.reload();
假设这是您在模式模式下显示的div。 您必须调用tb_remove()
以关闭模式窗口。 因此,只需使用location.reload();
在那之前。
<div id="modalContent" style="display:none">
<form>
...
</form>
<p style="text-align:center">
<input type="submit" id="Login"value="Click to close"
onclick="window.opener.location.reload();tb_remove()" />
</p>
</div>
如果使用facebox,只需添加window.location.reload();即可。 在第148行附近,所以您最终得到类似...的内容:close:function(){$(document).trigger('close.facebox'); window.location.reload(); 返回false}
如果仍然使用Thinbox,我相信它也一样简单。 搜索“关闭”并添加代码。
您可以使用tinybox插件轻松做到这一点:
http://sandbox.scriptiny.com/tinybox2/
var parentWindow = window;
$('#submit-deed-button').click(function() {
TINY.box.show({iframe:'submit_deed.html', closejs:function(){parentWindow.location.reload()}, post:'id=16',width:385,height:470,opacity:20,topsplit:3, boxid:'tinybox_container'})
});
关键是将父窗口作为JS var传递给函数,然后在该对象上调用location.reload()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.