How can I get user id from session in javascript?
PHP Snippet 1:
<input id="userId" value="<?php $_SESSION['user_id'] ?>" style="display:none">
PHP Snippet 2:
$( document ).ready(function() {
alert( $('#userId').val() );
console.log('done');
});