简体   繁体   中英

Redirecting to new page after closing popup window

To add the multiple items to Invoice i am opening pop-up window. Once i add the items, pop-up gets closed and returning to the parent page. But once the pop-up window closes, it should redirect to new page instead of parent page.

Now i am doing like this

In page1.php (parent page)

 <input type="button" class="btn btn-success" name="lineitems" id="lineitems" value="Add Line Items" onclick="window.open('add_lineitems.php?order_id=<?php echo $order_id; ?>',  'LineItems','height=500,width=1300,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">

In add_lineitems.php(popup) after adding, i am closing window like this

if($l1)
{

echo "<script>window.close();</script>";
}

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

Instead of page1.php, i want this to redirect page2.php. How can i mention it?

To redirect to another page you can used window.location .Add below code in your <script></script>

echo "<script>window.close();
window.opener.location='yourpage.php'; 
</script>";

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM