user3112260
user3112260

Reputation: 43

Get Classic ASP session variable into inline JavaScript

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>")

Upvotes: 1

Views: 532

Answers (1)

user692942
user692942

Reputation: 16681

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)

Upvotes: 4

Related Questions