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

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -