1

How to get the value of session in jquery. i have used this <%Response.Write(Session('toptabValue'))%> for getting value but cant get the value.

0

3 Answers 3

4

Store this value in an hidden field and use the value of that field.

Sign up to request clarification or add additional context in comments.

Comments

2

IN PHP, you can do it like this: (script should be top of js file)

<script>
var sessionData = '<?php echo $session['toptabValue']; ?>';
</script>

now you can use the

sessionData

variable in any js file.

Comments

0

A secure way of accessing the session ID in JavaScript is by setting a (preferably non-global) variable with the value of the session ID and use that variable in your scripts.

Using the session ID as form token enables an attacker to steal the session ID through XSS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.