Closing the child popup and updating the parent page

I am trying to achieve the following.

  • A link to the parent page will open a new popup.
  • In the child pop-up window, the user enters some data and clicks "Save."
  • The data will be saved in the database and the popup will be closed. The parent window will be updated, and the data entered in the pop-up window of the child will be displayed on the parent page.

How to do this (closing a child popup and updating the parent page) in Javascript?

+6
javascript popup
source share
3 answers

In the popup window:

<script type="text/javascript"> function proceed(){ opener.location.reload(true); self.close(); } </script> <form onsubmit="proceed()"> ... </form> 
+11
source share

In the popup for closing / reloading:

 opener.location.reload(); close(); 
+5
source share

parent.html

 <a href="#" onclick='window.open("child.html","_blank","height=100,width=100, status=yes,toolbar=no,menubar=no,location=no");return false'>pop up</a> 

child.html

 <p>child window</p> <script> window.onload = function(){ window.opener.location.reload(true); window.close(); }(); </script> 
+3
source share

All Articles