alin19 Posted February 12, 2008 Share Posted February 12, 2008 <script language="JavaScript"> <!-- var test = <?php //here i get data from a file ?> document.write(test) //--> </script> or do you know something beter? Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/ Share on other sites More sharing options...
haku Posted February 12, 2008 Share Posted February 12, 2008 That will work. You can't do it the other way around though (including javascript in php) Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/#findComment-465167 Share on other sites More sharing options...
haku Posted February 12, 2008 Share Posted February 12, 2008 as a side note, this is deprecated: <script language="JavaScript"> and should read: <script type="text/javascript"> Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/#findComment-465173 Share on other sites More sharing options...
alin19 Posted February 12, 2008 Author Share Posted February 12, 2008 10x i will try and see what comes out, want to make a dinamic grafic from a file file Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/#findComment-465175 Share on other sites More sharing options...
nikefido Posted February 12, 2008 Share Posted February 12, 2008 you aren't trying that in a .js file, are you? Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/#findComment-465245 Share on other sites More sharing options...
elpaisa Posted February 12, 2008 Share Posted February 12, 2008 If you want, to handle images in php, you should use GD library, or if you insist in using javascript for your purpose you should use the javascript inside <?php echo' '; ?> This should work for you, tell me if I can help more in this!. Quote Link to comment https://forums.phpfreaks.com/topic/90747-can-i-use-php-inside-a-java-script/#findComment-465261 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.