How to set javascript variable value to Session Variable
-
Hello, I want to set javascript variable value to session variable in javascript. I am able to get Session Variable value to javascript variable as, <%string str="s2345";Session["Resolution"]=str;%> var Id=('<%=Session["Resolution"]%>'); But I want to set javascript variable value say screen.width to my Session Variable. Please let me know if someone knows the way Swapnil Bhavsar
-
Hello, I want to set javascript variable value to session variable in javascript. I am able to get Session Variable value to javascript variable as, <%string str="s2345";Session["Resolution"]=str;%> var Id=('<%=Session["Resolution"]%>'); But I want to set javascript variable value say screen.width to my Session Variable. Please let me know if someone knows the way Swapnil Bhavsar
swapnilbhavsar wrote:
I want to set javascript variable value to session variable in javascript.
javascript runs on the client-side. session is a server-side object. you can't set javascript variable value to Session Variable in javascript.
Regards
J O H N :rose:
"Even eagles need a push." David McNally
-
Hello, I want to set javascript variable value to session variable in javascript. I am able to get Session Variable value to javascript variable as, <%string str="s2345";Session["Resolution"]=str;%> var Id=('<%=Session["Resolution"]%>'); But I want to set javascript variable value say screen.width to my Session Variable. Please let me know if someone knows the way Swapnil Bhavsar
You have to pass the javascript variable to the server somehow, and set the session variable there. You can use AJAX methods, or some postback event to get the variable to the server.
only two letters away from being an asset