• 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

PHP returning an error message and false

Match csv filenames to table names and import

dockerizing Laravel + vue

Unable to get password for the instance created from AMI

Insert database rows from columns of data from associative array of indexed arrays

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Two buttons one form

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

How to display table header in every page using FPDF library?

generating a random code in php?

I'm trying to write a clean url for my website using the $_SERVER['REQUEST_URI'] in php

How can I get a div content in php

PHP - CURL using HTTPS [closed]

Check if a string contain multiple specific words

PHP block shortcut in Visual Studio Code

About Contact Privacy policy Terms and conditions