hi all,
is there any way to set Session variable from javascript in asp.
Printable View
hi all,
is there any way to set Session variable from javascript in asp.
No - javascript is client side; ASP is server side.
What you could do though, is use javascript to set a hidden variable's value & post the page back to itself, setting the session variable then.
Code:<%
Dim MyValue
MyValue = Request.Form("hidValue")
%>
<html>
<head>
<title>Blah</title>
<script language="javascript" type="text/javascript">
function postBack(myValue) {
var theForm = document.frmBlah;
theForm.hidValue.value = myValue;
theForm.submit();
}
</script>
</head>
<body>
<form id="frmBlah" name="frmBlah" method="post">
<input type="hidden" id="hidValue" name="hidValue">
</form>
</body>
</html>
Javascript could be a server side script as weelQuote:
Originally posted by axion_sa
No - javascript is client side; ASP is server side.
Granted, but I think the context here was client side - could be wrongQuote:
Originally posted by andreys
Javascript could be a server side script as weel