troubleshooting Question

C# variable into Javascript variable

Avatar of Nugs
Nugs asked on
5 Comments1 Solution767 ViewsLast Modified:
Arrrgg, i have been assigned the BORING task of implementing some Yahoo javascript onto one of the website we manage.

They have asked me to pass in a variable for the amount of a purchase.

How do i get my C# variable into a javascript valiable that i can pass in here... Also this purchase amount happens to also be in a session...

Here is some code...
<SCRIPT language="JavaScript" type="text/javascript">
    <!-- Yahoo! Inc.
        window.ysm_customData = new Object();
        window.ysm_customData.conversion = "transId=,currency=,amount=";
        var ysm_accountid  = "**********************";
        document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' " 
        + "SRC=//" + "********************" + "/script/ScriptServlet" + "?aid=" + ysm_accountid
        + "></SCR" + "IPT>");
    // -->

where you see the window.ysm_customData.conversion = "transId=,currency=,amount="; they want me to do something like this: transId=trans,currency=,amount=val";

The session i have with the amount is: Session("TotalCost") and i will need to cast it as a double....

Can someone show me how to throw this into this Javascript?


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros