I'm able to print the following item name values using the following in PHP.
I'm stuck trying to take a PHP array, and use it in JavaScript.
foreach($orderArray[0]->items as $data){
echo $data->name; echo "<br>";
echo $data->productId; echo "<br>";
}
How would I take this array, and make this an array in JavaScript and print the values of name and productId
for each item ?
I'm new to JavaScript and know I can convert the array as below, but not sure how to get the values into a JavaScript's Multidimensional Associative array, where I can print the values in JavaScript.
var array1 = '<?php echo json_encode($orderArray); ?>';