set session value in javascript code example
Example 1: how to get session value using javascript
sessionStorage.getItem("SessionName")
Example 2: how to use session using javascript
BY LOVE
sessionStorage.setItem("SessionName", "SessionValue");
Example 3: set a value in session using javascript
<script type="text/javascript">
function GetUserName()
{
var username = '<%= Session["UserName"] %>';
alert(username );
}
</script>
Example 4: how to get session value using javascript
By LOVE
sessionStorage.getItem("SessionName")
Example 5: set a value in session using javascript
<script type="text/javascript">
function SetUserName()
{
var userName = "Shahid Bhat";
'<%Session["UserName"] = "' + userName + '"; %>';
alert('<%=Session["UserName"] %>');
}
</script>