• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How can I get user id from session in javascript?

javascriptphpcodeigniter


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');
});

Related Snippets

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

I want a way to give path to my files which are outside of public folder in laravel

Query Optimization, changing the queries in the loop into a single processing query

MySQL order by field in Eloquent

laravel 5.6 bulk inserting json data

google content api for shopping

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

Testing subscription renewals on Stripe

Move a child array to parent array and change parent/child name

Could not decode a text frame as UTF-8.

Handling expired token in Laravel

(Cache::lock()) -> get() -- Under what conditions does it return false?

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

WooCommerce Additional Information - if empty, hide

How to set a domain name with php artisan serve

About Contact Privacy policy Terms and conditions