reading session variables in javascript??

Gow

Member
Aug 10, 2000
35
0
0
Hi there

What i need is a site or some code that will allow me to read the contents of a session variable created in ASP...

The thing is i want to read it using javascript, can someone help, please

i have a 2d array created in ASP and stored in a session variable...

I want to check the contents of the array against multiple form text boxes, and i need it done in javascript..

can this be done?
am i trying to do the imposible?

i have searched for hours and not found an answer...

All help greatfully accepted

Thanks


 

Argo

Lifer
Apr 8, 2000
10,045
0
0
There is no direct way. Session persists on the server, javascript runs on the client. Depending on what your goal is, the only workaround would be to have asp page write out different JSP based on what the value of the session variable is.

You can also write a thread or asp page that will listen on a specific port and serve request for the jsp script running on the client. This solution is pretty cumbersome though.
 

GilletteCat

Member
Dec 28, 2001
181
0
0
let's say you have a one-dimentional VB-safe array and you have assigned it to a session variable on one page to be able to retrieve it on another.
the code for the <head> of the retrieving page would be:
<script language=javascript>
var MyVBArray = new VBArray(<%=Session("MySessionArray_Blah_Blah")%>);
var MyJSArray = MyVBArray.toArray();
</script>
If you want to compare the value of a text-box object on the page to a value in the array, you have to know which index in the array that value occupies. For example, we would compare the value of the text-box my_input_field_1 to the value of the first member of the array:
<script language=javascript>
if(document.myform.my_input_field_1.value == MyJSArray[0]) {
.....
}
Remember, the array index is 0-based.

Hope it helps.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
GilletteCat:

I had no idea there was a way to do that. I was thinking from JSP/Servlets perspective.
 

eklass

Golden Member
Mar 19, 2001
1,218
0
0
you will have to read the session variable sfrom ASP and have them print out the javasript code to check for it

in otherwords, use serverside code to create dynamic client-side code

i do this when checking out in an ecommerce storre and the user wants t0o specify "same as billing" for thier shipping address. when the user clicks the checkbox, all the text boxes are fille din via javascript. the way javascipt know is i use php to print out:

document.form[0].s_name.value = 'john doe';


wherein the john dow part between the single quotes is a session vairable

if you don't get it, read my sig. if you still dont' get it, maybe it's just over your head (the process, not the pancakes)
 

Gow

Member
Aug 10, 2000
35
0
0
This does not work for me.....



<script language=javascript>
var MyVBArray = new VBArray(<%=Session("MySessionArray_Blah_Blah")%>);
var MyJSArray = MyVBArray.toArray();
</script>

I don't know why, it just dont...

I got this error mesage once..

Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.


can anyone tell me how to read a normal session variable......

is it somthing like

var test = <%sesstion("test")%>;

if i can get that to work i may be able to sort the rest out...
 

eklass

Golden Member
Mar 19, 2001
1,218
0
0
this is what you need:


<script>
var something = '<%=Session("something_else")%>';
</script>
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |