Jump to content

php variable into js variable


Obi1-Cannabis

Recommended Posts

Is it possible to pass a php variable into a js variable without the use of post get or ajax?i thought maybe something like:

<? print"<script language=JavaScript>";print"var jsVar= '".$phpVar."';";print"</script>";?>

I think it actually does work, but it keeps giving me errors that don't have anything to do with this variable but that don't appear when i'm not using that variable... :)

Link to comment
Share on other sites

You might want to post this in the PHP forum (or do a search there because I swear someone has recently asked this very question there).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...