Jump to content

Javascript echoing a PHP variable?


rubahfgouveia

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.