• 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 set a domain name with php artisan serve

CodeIgniter 4: Like and Dislike Functionality

How to show a popup modal in codeIgniter?

Chunk and transpose a flat array into rows with a specific number of columns

php echo xml documents with header

Applying programmatically a coupon to an Order in WooCommerce3

How can I make this nested location configuration use the correct path to call a php program?

Laravel Mix Uncaught ReferenceError: $ is not defined

How can i hide dt if dd got empty value

how to identify the web server name of remote host

Laravel Sanctum CSRF not authenticating

best way to store error messages in Laravel (session or variable)

How to identify whether webp image is static or animated?

Why is this PHP array not the same?

How in Laravel run JavaScript code stored in php variable?

About Contact Privacy policy Terms and conditions