I am using backbone.js to create a view with a button. When the button is clicked, data containing the logged in user’s user_id is sent back to the server via AJAX.
Problem: I am using a PHP backend (Laravel) which uses database sessions (using a Session class to store the user’s user_id in the database). How can I retrieve this user_id using Javascript/jQuery/backbone.js?
very ture , store as
“span id=”usersessionid””
and you can grab it using $(“usersessionid”).html() etc. Not sure that is what you want to achieve.
give span an id=usersessionid and put $_SESSION[‘user_id’] inside. You can hide that span.
sorry, kind of struggling to get the code displayinghere….