And PHP Arrays[ ] ?!?
inside of your JavaScript section, insert a <?php?> snippet
<script type="text/javascript">
var phpName = new Array();
var phpDesc = new Array();
<?php
foreach($imgName as $key => $value)
{
echo "phpName[$key] = $value;\n"; //number
}
foreach($imgDesc as $key => $value)
{
echo "phpDesc[$key] = \"$value\";\n"; //string
}
?>
</script>
make sure to escape your double quotes!
This will print out the javascript with each iteration explicitly assigned, but it works! (no json or anything needed)
<script type="text/javascript">
var phpName = new Array();
var phpDesc = new Array();
<?php
foreach($imgName as $key => $value)
{
echo "phpName[$key] = $value;\n"; //number
}
foreach($imgDesc as $key => $value)
{
echo "phpDesc[$key] = \"$value\";\n"; //string
}
?>
</script>
make sure to escape your double quotes!
This will print out the javascript with each iteration explicitly assigned, but it works! (no json or anything needed)
0 Comments:
Post a Comment
<< Home