关闭子窗口后PHP刷新父窗口

I have 3 php files: view.php, edit.php and edit2.php.

view.php is where I view the content of my database. I use edit.php to enter new data and it's a small window that in which I type in a content I want to include in my db.
Then, I pass all of the data to edit2.php which doesn't display anything but only has implemented MySQL queries.

Now I would like to have something like this:

I'm on view.php. I click a button, edit.php opens as a new, small window. I enter the data, click SUBMIT button, everything is sent to edit2.php but at the same time the window is closed and view.php is refreshed.

I would be thankful if you could help. Thanks in advance.

You can use the js function window.opener.location.reload().There is no need of ajax for refreshing the page..Simple js is enough.

Add following code to your edit.php

    <script>
    window.onunload = refreshParent;
    function refreshParent() {
        window.opener.location.reload();
    }
   </script>

You may use header('Location: view.php'); at the end of your edit2.php