I’m trying to figure out I how can do something like:
console.log('<?php print_r($_SESSION); ?>');
To see the results in the console.
console.log('<?php echo serialize($_SESSION); ?>');
does not work either. Is there a way for me to echo the session information in firebug or inspect element in chrome for testing purposes?
You could try this :
No quotes are required. See as well Firebug and Logging.
[edit, May 2014] Updated the code to be safe against XSS attacks. Always pass
JSON_HEX_TAGtojson_encodeif you’re embedding in HTML, or an attacker could inject code into the DOM by having you encode a string like: