• 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

Redis Command To Sort Keys

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

Send POST data via raw JSON with Postman

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

Must be of the type array, null given,

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

Laravel Passport - Not able to get token string in response?

How to break out of a foreach once a condition is met?

ORA-12546: TNS:permission denied error connection to remote oracle server

mysql slow on updates for a well optimized query

Dynamic dropdown Ajax PHP request

dockerizing Laravel + vue

How to identify whether webp image is static or animated?

Insert multidimensional array to codeigniter cart

java URL working on browser but not in client program

About Contact Privacy policy Terms and conditions