Refresh a page after Submit PHP

Asked

Viewed 1,563 times

1

I want to refresh my page (refresh), after clicking a button that is in a popup. This is the form of the popup page.

<form method="POST" action="_cal.php" >
        <input type=submit value=Fechar onclick=window.close()>
</form>

When you click on the close of the popup, I want to update my "_cal.php page".

  • This popup opens on the _cal.php page ?

  • No, it’s opened by other popup.

2 answers

2


In popup, enter in event onunload (that will be triggered when you have close the popup) for the parent page to be reloaded.

<body onunload="window.opener.location.reload()">

2

It follows an alternative adapted from a reply from Sozão:

This code is an interesting alternative if you prefer that the control is on account of the window that opens the popup, and not within the popup proper.

function pop() {
  var child = window.open('http://ddg.gg', '','toolbar=0,status=0,width=400,height=200');
  var timer = setInterval( CheckChild, 500 );

  function CheckChild() {
    if (child.closed) {
      alert("Aqui voce recarrega a pagina");
      clearInterval(timer);
    }
  }
}

See working on JS Fiddle.

Just change the line of alert for window.location desired.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.