dsilhx5830 2019-02-27 04:48
浏览 240
已采纳

关闭弹出窗口后重定向到新页面

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?

  • 写回答

1条回答 默认 最新

  • dougaoshang0237 2019-02-27 05:11
    关注

    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>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?