• 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

Refresh specific HTML content that retrieves data from MySQL

Could not decode a text frame as UTF-8.

Put content of wordpress page inside div

How to Generate PDF invoice to XML format using mPDF

How to fix Call to undefined method AppModelsTableName::factory?

Laravel 5 issue with wherePivot

Execute only one time and then wait set period of time before executing again

301 Redirect to remove query string on homepage only

How to show selected value using javascript in laravel

How to redirect to another page and call a Function there on Angular ng-click

Remove categories with all childs derived from parent category

Transpose and flatten multiple rows of array data [duplicate]

Fetch files from next cloud storage and display in Laravel website

how to remove %20 in the url in php

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

About Contact Privacy policy Terms and conditions