我有问题.我有一个页面,当您单击按钮时,会显示一个带有表单的弹出窗口.所以,我完成了一些数据并提交.我想要做的是,提交表单,关闭表单并刷新父页面.我不想用 AJAX 来做.
I have a problem. I have a page that when you click a button, a popup with a form is shown. So, I complete some data and I submit. What I want to do is, to submit the form, close the form and refresh the parent page. I don't want to do it with AJAX.
问题是在我的父页面中,我必须使用表单的输入信息刷新内容.
The problem is that in my parent page I have to refresh content with the input information of the form.
所以当我刷新时,有时会显示数据,有时不会.你知道为什么会发生这种情况吗?
So when I refresh, sometimes the data is shown and sometimes not. Do you know why this could happen?
我只是在表单中使用 onsubmit="refreshParent()".信息总是存储在我的数据库中,所以我认为问题可能是有时刷新会捕获新信息,有时不会.
I just use onsubmit="refreshParent()" in my form. The info is stored always in my database, so I think the problem may be that sometimes the refresh catches the new info and sometimes not.
function refreshParent() { window.opener.location.reload(); window.close(); } 推荐答案我用它来重新加载打开弹出窗口的页面:
I use this to reload the page that opened a popup window:
<script language="JavaScript"> <!-- function reloadParentPage() { window.opener.location.href = window.opener.location.href; if (window.opener.progressWindow) { window.opener.progressWindow.close() } window.close(); } //--> </script>顺便说一下,上面的代码是通过弹出页面中的链接或按钮调用的.
By the way, the code above is called by a link or button in the popup page.
更多推荐
JavaScript 中的 PHP 和 window.close
发布评论