Click here to Skip to main content
15,905,682 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
How to store session in java script function in Classic ASP....My script is

JavaScript
<script language="JavaScript">
function SubmitPtEditor()
{
document.getElementById('sessionhidden").value=document.getElementById("editPtLastName').value
//session('last")=document.getElementById("editPtLastName");
alert(document.getElementById("sessionhidden").value);
document.getElementById("Form1").submit();
popupWindow = window.open("../dashboard/test.asp","popUpWindow")
}
</Script>

//session('last")=document.getElementById("editPtLastName"); is not working.
I want to use this please reply what is the problem


Thanks & Regards
Srishti Gupta
Posted
Updated 29-Oct-13 20:06pm
v3
Comments
Prasad Khandekar 30-Oct-13 2:35am    
Hello Srishti,

The HTTPSession is s server side container and available only on the server side. If you want to make the values stored in session to a client side script then you can
1. Write a HTTP Service which will take names of the session variables (Comma Separated) and return the values (as JSON)
2. Have a hidden field and store the serialized session (JSON format) in it.

Regards,

1 solution

ASP cannot understand what the user are typing. So if you want to store document.getElementById("editPtLastName") into session, you should do it after the form is submitted.
For example, your form's action is "PtProcess.asp", so in your PtProcess.asp file, you could code like this:
HTML
Session("last") = Request("editPtLastName")
 
Share this answer
 
Comments
srishti_ 30-Oct-13 3:13am    
its not working session was not stored in this way....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900