How to access php SESSION variable in javascript

How to access php SESSION variable in javascript  #angularjs #reactjs

  • I’m not able to access myvar in general.js – eagleAtlantis 3 hours ago
  • Stack Overflow works best with JavaScript enabled
  • @eagleAtlantis Please find modified code snippet in above answer – Rubin Porwal 2 hours ago
  • You can get the Session using PHP, and then use that for the JavaScript like this
  • Browse other questions tagged javascript php or ask your own question .

I’m trying to create an image uploading website. In this, when a user logs in, I set a $_SESSION[‘id’] variable in php. Now, I wish to check if $_SESSION[‘id’] is set in my javascript file (general.js) in order to carry out certain functions. How should I go about doing it?

@ng_real_ninja: How to access php SESSION variable in javascript #angularjs #reactjs

In above code snippet I have initialized global variable myvar with value stored into php session variable into script file before general.js file is referenced in script.It will be accessible in general.js file

Is there evidence to suggest the “war on drugs” was a cover for class warfare?

“Barking up the wrong tree” <- What does "bark" refer to here?

How to access php SESSION variable in javascript

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.