Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag 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

Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

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
Avatar of Whing Dela Cruz
Whing Dela Cruz
Flag of Anguilla image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

Thanks a lot Julian, your explanation gives more clearer to me. I will try it now!
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!
@Whing Dela Cruz

are you accepting your own comment as the assisted answer?
You are welcome