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