How can I open a popup with some code and it close by itslef when finish it job? And also reload the page that opened the popup. Confused? So am I . Sorry lol
eg:
Page_1 has a button that open a new window (Page_2) with a form. When I submit that Page_2 form, Page_2 should close and Page_1 refresh by it self too.
Is it possible? Can you link a guide or help me somehow?
Im using, PHP, Javascript.
Thanks
On the parent page you will need a function to load your child page and a function that will reload itself
<script type="text/javascript">
function loadPopup(){
window.open("yourpopup.html");
}
function reloadPage(){
window.location.reload()
}
</script>
Now on the popup page you can call the parent function with "opener" like so:
<script type="text/javascript">
function somethingWasClicked(){
window.opener.reloadPage();
window.close();
}
</script>
You could use something like this:
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.