Re: how to pass an array to Java script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux