• 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

Failing validation doesn't stop code execution in livewire component

Redis Command To Sort Keys

PHPExcel How to set conditional formatting to change cell background color based on cells values

PHP usort() order in case of equality

Unable to guess the mime type as no guessers are available Laravel 5.2

How can I get a div content in php

Shortcode or PHP inside a shortcode in Wordpress

Laravel Get Days In Month From Month Number?

browsersync doesn't work with XAMPP

How to show a popup modal in codeIgniter?

Laravel websockets AWS EC2 - Connection failed

Laravel lang slug in url

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

Adding one microsecond to Datetime object in PHP

Losing session data after POST from third party website

About Contact Privacy policy Terms and conditions