Click here to Skip to main content
15,844,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how do navigate to page from window.open with parameter but paramter (BillNo) doesn't exist there isn't exist in address bar
my code
appear in address bar as
HTML>
function RowClick(BillNo) {
                                            window.open('/AllOrders/OrderDetails?BillNo=${BillNo} ' , "_self")

                                        }


What I have tried:

my link in addressBar is
HTML></a><a
function RowClick(BillNo) {
                                            window.open('/AllOrders/OrderDetails?BillNo=${BillNo} ' , "_self")

                                        }
                                    </a>
Posted
Updated 25-Jun-23 19:35pm
v2

1 solution

You can open window with params. Define them clearly as part of url:

Write them without single-quotes and as expected (define them separate before making part of url):
JavaScript
window.open("http://yourdomain.com//AllOrders/OrderDetails?billno="+billno ,"_self");
In case the value needs to be evaluated/customized:
JavaScript
mybillno = BillNo+"somemodification";
myurl = "http://yourdomain.com//AllOrders/OrderDetails?billno=" + mybillno; 
window.open(myurl ,"_self");

Reference:
Window: open() method - Web APIs | MDN[^]
Window open() Method[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900