Solved

calling a session

Posted on 2008-06-25
3
344 Views
Last Modified: 2012-05-05
hello I need to call a session into my js

    <script type="text/javascript">
<!--
P7_opEPM('p7EPM_1',<%= Session("accorwinopened") %>,2,1,0,0,1000,1);
//-->
</script>

how best can i do this, when i plonk  <%= Session("accorwinopened") %> on the page I see it. but it does not seem to work in side the js. the js works if i just put in a number but i need it to respond to a session value as the page loads.

regards

k
0
Comment
Question by:thatelvis
  • 2
3 Comments
 
LVL 15

Assisted Solution

by:crisco96
crisco96 earned 500 total points
ID: 21868717
If I'm right you're trying to get this method to work when Session("accorwinopened") contains something other than a number. In order to do that you just need to surround it with single quotes.


<script type="text/javascript">

<!--

P7_opEPM('p7EPM_1','<%= Session("accorwinopened") %>',2,1,0,0,1000,1);

//-->

</script>

Open in new window

0
 
LVL 1

Author Comment

by:thatelvis
ID: 21872631
Thank you crisco

I gave that a rattle but to no effect. when I actually have the session on my page i can see the digit change, but it is when its inside the above js that it does not make the change.

I am open to any other suggestions

regards

K
0
 
LVL 1

Accepted Solution

by:
thatelvis earned 0 total points
ID: 21872839
Crisco I got it

Thanks for your help

<%
if (cStr(Request.Form("updbutton")) <> "")  then
  Session("accorwinopened") = "5"
end if
%>
<%
if (cStr(Session("accorwinopened")) = "")  then
  Session("accorwinopened") = "1"
end if
%>

<script type="text/javascript">
<!--
P7_opEPM('p7EPM_1',<%= Session("accorwinopened") %>,2,1,0,0,1000,1);
//-->
</script>

lol I had given the wrong value to the top session creation, i gave it 4
rather then 5 lol.

any way it all works fine now

cheers

k
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now