• 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

Why rand() every time I refresh the page?

generating a random code in php?

Laravel phpunit test failing authorization

How to disable widget block editor of WordPress?

How to add a heading in between checkout fields of WooCommerce

how to search for a file with php

how to validate form data in codeigniter 4

Additional price based on cart item count in WooCommerce

Star rating with half star support

Update Order custom Field value with WooCommerce REST API

How to loop a tree array with unknown depth and get array blocks?

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

WooCommerce Subscriptions: Remove role on cancelled subscription

MySQL - Connection failed: No route to host

If you intend you use SMTP, add your SMTP Code after this Line

About Contact Privacy policy Terms and conditions