• 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

find in set in laravel ? example

Inserting data into SQL Server Db An Invalid direction was specified

OAuth2 Token PHP

I want to display a sweetalert after the inserting of data in my database

how to insert data into select2 search input after scan using qrcode

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

How to convert a carbon into string, to take the date only?

Assets not referencing to public folder (Laravel)

How can i hide dt if dd got empty value

How to get monthly wise data in laravel

Update Total in checkout of Woocommerce with Ajax Request

Exact alternate to mcrypt_encrypt in PHP 7.2

How to get the ID of the link in another page in php

Add a custom text for a particular product on specific email notification in Woocommerce

Refresh specific HTML content that retrieves data from MySQL

About Contact Privacy policy Terms and conditions