note 110908 deleted from faq.html by aharvey
| From: | aharvey@php.net | Date: | Sat, 22 Dec 2012 05:18:11 +0000 |
| Subject: | note 110908 deleted from faq.html by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192643@lists.php.net to get a copy of this message | ||
Note Submitter: asok1111 at gmail dot com
----
There is another method to pass data between php and javascript and this can be done by creating
javascript objects. After creating objects we can initialize and use properties of that object.
ex.
echo "<script type='text/javascript'>myOBJ['id[" .
$productsname['product_id']. "]']='-1';</script>";
here we have initialized the property id['someid'] , which is unknown property name now,
at run time of the object myOBJ which can be created as myOBJ =new Object() or using literal
notation myOBJ ={}. Please note that this initialize object can be compared with another value using
for in loop in javascript.