How Can I Get Session Via Javascript

How can I access the session value from javascript

You can acesss the session variable from PHP code to javascript code like following:

<?php
$testphp = $_SESSION['test'];
?>

<script>
var testjs = "<?php echo $testphp; ?>" ;
alert("test= " + testjs );
</script>
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments