rubahfgouveia Posted August 17, 2010 Share Posted August 17, 2010 Hello all, I'm really new in JS and I was wondering if it's possible to get a PHP variable, and use it inside JS. for example: <? $x = 7; ?> <script> teste.funct = function (e) { var fff = new G.P('myc3',[<?php echo "$x"?>,3,5,6,2,1,4]); } </script> something like that.. Link to comment https://forums.phpfreaks.com/topic/210909-javascript-echoing-a-php-variable/ Share on other sites More sharing options...
Alex Posted August 17, 2010 Share Posted August 17, 2010 Give it a try. Link to comment https://forums.phpfreaks.com/topic/210909-javascript-echoing-a-php-variable/#findComment-1100058 Share on other sites More sharing options...
rubahfgouveia Posted August 17, 2010 Author Share Posted August 17, 2010 works just fine sorry for bothering.. I was already expecting the worse Cheers, and thanks Link to comment https://forums.phpfreaks.com/topic/210909-javascript-echoing-a-php-variable/#findComment-1100062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.