• 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 validate tin and cst using PHP?

Smarty if isset

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

How to create custom authentication in laravel 8?

PHP array, move keys and values to new array, but mix it up

How to submit a form when page loads using JavaScript?

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

PHP: How to raise number to (tiny) fractional exponent?

PHP Warning: Module already loaded in Unknown on line 0

How to submit a form when page loads using JavaScript?

How to break out of a foreach once a condition is met?

How to install php yaml on CentOs?

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

html-php form submission after validation through JavaScript [closed]

how to create html table in php

About Contact Privacy policy Terms and conditions