• 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

How to change product Image when variables are selected in Shop and Archive Pages?

Target Laravelista is not instantiable

wordpress : How to specify the cause "This site can’t be reached"

How to show selected value using javascript in laravel

With doctrine ODM, can I embed many subdocuments in a main document?

How to debug in WooCommerce 3+

PHP 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

How to get the total hour from starting time to end time in php

passwordless LDAP login and get user information using Kerberos ticket in PHP

Make Calculator - When Button clicked the No shows in Textbox.

Unit (real unit test) of test laravel relationship

How do I do HTTP basic authentication using Guzzle?

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Cache clear probem in Larave

PHP to search within txt file and echo the whole line

About Contact Privacy policy Terms and conditions