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? 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. 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. 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 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
Archived
This topic is now archived and is closed to further replies.