1

How do I get a session variable into this JavaScript on a Classic ASP page?

report = Response.Write("<script type=""text/javascript"">window.open(""http://somesite.com/payvoucher.aspx?usercode=session(USERCODE)"",""_self"");</script>")
0

1 Answer 1

3

You need to concatenate the session variable Session("USERCODE") into the string using the string concatenation character &, unlike other languages VBScript doesn't infer a variable just by placing it inside the string.

Dim report: report = "<script type=""text/javascript"">window.open(""http://somesite.com/payvoucher.aspx?usercode=" & Session("USERCODE") & """,""_self"");</script>"
Call Response.Write(report)
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.