• 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

Confirm Leave on External Links in Wordpress

Open a popup box after receiving result from ajax

WooCommerce Subscriptions: Remove role on cancelled subscription

How to submit the custom form data in database in WordPress without plugin using ajax?

I want to store data in new index as per my key in php [duplicate]

Laravel Multi-language routes without prefix

Explode not working properly with dash

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

Last order would be re-order in wooCommerce. How is it possible?

Backend cannot be reached after Typo3 login screen

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

Laravel update hasMany relationship using saveMany

How can i hide dt if dd got empty value

Laravel Blade checkbox not checked

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

About Contact Privacy policy Terms and conditions