Monkuar Posted May 7, 2009 Share Posted May 7, 2009 If i make a variable in PHP.. and I have a external .js file i can call variable in my external .js to work with my php variable right? Quote Link to comment https://forums.phpfreaks.com/topic/157177-solved-php-question-with-variables/ Share on other sites More sharing options...
Maq Posted May 7, 2009 Share Posted May 7, 2009 If i make a variable in PHP.. and I have a external .js file i can call variable in my external .js to work with my php variable right? It depends, what exactly are you trying to do? Remember PHP lives on the server while JS is client side. Quote Link to comment https://forums.phpfreaks.com/topic/157177-solved-php-question-with-variables/#findComment-828208 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 You can have PHP write out a variable value in JavaScript. Like: echo '<script type="text/javascript">var e = "foo";</script>'; Then you can reference it with JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/157177-solved-php-question-with-variables/#findComment-828264 Share on other sites More sharing options...
Monkuar Posted May 7, 2009 Author Share Posted May 7, 2009 thxxxx Quote Link to comment https://forums.phpfreaks.com/topic/157177-solved-php-question-with-variables/#findComment-828450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.