• 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

wp_remote_get() not passing authentication

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Laravel 5.1 Unknown database type enum requested

str_word_count() function doesn't display Arabic language properly

How to insert data from multiple select dropdown values into database?

Laravel/docker-compose/redis - Class 'Redis' not found

laravel MVC execution flow

CONCAT columns with Laravel 5 eloquent

Inserting data into SQL Server Db An Invalid direction was specified

Having issue with matching rows in the database using PDO

how to remove %20 in the url in php

ldap is missing from system when installing adldap2 in laravel

Must be of the type array, null given,

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

php curl requesting twice

About Contact Privacy policy Terms and conditions