Is it possible to access session variables made in from JavaScript, and how can I replicate this PHP code in JavaScript?
if(empty($_SESSION['name'] {
echo 'foo';
}
You could access a page via Ajax which would return the variable value:
Using jQuery:
$.get('myVariable.php', function ( data ) {
alert(data)
});
And the PHP page (myVariable.php):
<?php echo $_SESSION['user_id']; ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With