how to assign PHP session value to Javascript variable -


How can I specify the value of the session in the JavaScript variable? For example, I type javascript variable names to $ _ session ['name'] . Thank you.

Good, four options:

  • Set it with php , Javascript in & lt; Script type = "javascript" & gt; Var name = "& lt ;? php echo $ name ;? & gt;"; & Lt; / Script & gt;
  • Set up a cookie with PHP, and recover it with javascript (,)
  • Use jquery Ajax () ())
  • Set it as a GET variable (end of the URL) ()

Comments