Re: how to pass an array to Java script

From: Date: Sat, 10 Dec 2005 04:43:47 +0000
Subject: Re: how to pass an array to Java script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227249@lists.php.net to get a copy of this message
On Dec 9, 2005, at 8:30 PM, Johny John wrote:
Hi,
         How to pass an array (from php )  to java script and display it
using javascript?... Jasus.
Well, FWIK, Here is how you pass a variable: <script type="text/javascript" language="javascript"> <?php echo "var picUrl = '$picUrl';\n"; ?> document.write(picUrl); </script> So, if you know how to instantiate an array in JS, just do a PHP loop where you pull contents out of the PHP array an put into the JS array... then you can do whatever you want with the array later in your JS script... AFAIK. Hth, Cheers, Micky

« previous php.general (#227249) next »