Avatar of Whing Dela Cruz
Whing Dela Cruz
Flag for Anguilla asked on

Session on Html

Hi experts, I'm trying to change the value of Session inside the script but it doesn't work. Any help please!

<script>
function ChangeSession()
{
    Session("AllowT") = "T"
}
</script>

Open in new window

HTMLJavaScriptASP

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
Ryan Chong

session should runs at server side not like javascript which runs on client side.

do you mean something like this?

<script>
function ChangeSession()
{
<%
    Session("AllowT") = "T"
%>
  var t = "<%=Session("AllowT")%>";
   alert("T = " + t);
}
</script>

Open in new window

SOLUTION
Whing Dela Cruz

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

can I do something like variable declared in script and put the value in Session?
you probably can't until you do a posting to server side.

to change something on Session, you need to do it on server side end.

hope this clarifies.
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Whing Dela Cruz

ASKER
Thanks a lot Julian, your explanation gives more clearer to me. I will try it now!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Whing Dela Cruz

ASKER
Thank you both of guys, your  comments and suggestion helps me a lot to understand. More power to both of you and May God give more knowledge to help those who are in need!
Ryan Chong

@Whing Dela Cruz

are you accepting your own comment as the assisted answer?
Julian Hansen

You are welcome
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.