• 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

Sum array values

How to auto populate preferredCountries from intl-tel-input with db output

Prestashop webservice API creating cart rules

Execute only one time and then wait set period of time before executing again

using random function but it's displaying duplicates

how to remove %20 in the url in php

How to send upload image through email

Laravel Nova, route not found

Form repeater send wrong data with last element in Laravel

How can I make a full text index of the column?

Symfony autowiring issues since docker update

How to test a php login connected to a mysql db through xampp?

Get sum of arrays inside array

Query Optimization, changing the queries in the loop into a single processing query

Create a new line whenever an array value reaches more than 10 characters

About Contact Privacy policy Terms and conditions