Saturday, April 13, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  65] [ 5]  / answers: 1 / hits: 70157  / 16 Years ago, mon, february 16, 2009, 12:00:00

I have created a SCORM API for our LMS and right now I am using hard coded userID and courseID variables (variables that reference things in the database). I need to pass the real userID and courseID instead of using hard coded ones. I know the userID is stored in the session and the courseID is passed over from the launch page.



How do I get these into JavaScript so I can include them in my calls to the .ashx that handles the SCORM calls?


More From » asp.net

 Answers
11

Probably best easiest to expose them as properties of your page (or master page if used on every page) and reference them via page directives.



 <script type=text/javascript>
var userID = '<%= UserID %>';
var courseID = '<%= CourseID %>';

.... more stuff....
</script>


Then set the values on Page_Load (or in the Page_Load for the master page).



  public void Page_Load( object source, EventArgs e )
{

UserID = Session[userID];
CourseID = Session[courseID];
...
}

[#99972] Friday, February 6, 2009, 16 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yaquelina

Total Points: 517
Total Questions: 101
Total Answers: 96

Location: Egypt
Member since Tue, Jul 6, 2021
3 Years ago
yaquelina questions
;