0

I have a javascript function to open the new window when we click the link but i want to pass the value "id" to another page. How can I add the value to url> Following is the code...

 <SCRIPT language="JavaScript1.2">
    function openoldgurantorwindow()
      {
     window.open("enter code heregurrantor/old",
    "mywindow","location=1,status=1,scrollbars=1,width=700,height=700");
    }
    </SCRIPT>
    <a href="javascript: openoldgurantorwindow()">Click to view old Guarantors</a> 

Thank you in advance.

1
  • So where is the value id. Where will you get it from? PHP or javascript?? Commented Jul 17, 2018 at 12:47

1 Answer 1

1

You can pass id or any other parameter as query params like shown below:

function openoldgurantorwindow(id) {
    window.open("http://example.com?id=" + id,
            "mywindow", "location=1,status=1,scrollbars=1,width=700,height=700");
}

And can be retrieved at next page in PHP code in $_GET variable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.