• 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

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

Python - Include another Python script

Composer fails with kylekatarnls/update-helper on new homestead

phpseclib 2.0 can not use Composer to create autoload

MySQL - Connection failed: No route to host

How to fix bootstrap multiselect search data using ajax

How to give apache permission to write to home directory?

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 [closed]

add uri parameter to Route name in laravel

Check if a string contain multiple specific words

Reducing authentication calls on external API (Laravel 5.6)

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

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

Creating live search with AJAX and CodeIgniter

How to upload mpdf file after generating to s3 bucket in php

About Contact Privacy policy Terms and conditions