Page 1 of 1

i want to access the session information in javascript

Posted: Tue Jul 07, 2009 2:40 am
by lokesh_kumar_s
hi i want to access the session information in javascript is it possible, if so then please specify how.
i will provide you the example code. i am setting the session variable in php and i want to access that session variable in javascript.

Code: Select all

 
<?php
$_SESSION['admin']="lokesh";
?>
 
now how can i access $_SESSION['admin'] in php please help

Re: i want to access the session information in javascript

Posted: Tue Jul 07, 2009 2:42 am
by VladSun
Like this:

Code: Select all

<script>
var admin = '<?php echo $_SESSION['admin']; ?>';
</script>