When we convert PHP array into JS array then we get all values in string.
For example:
var ars= '<?php echo json_encode($abc); ?>';
The issue in above method is when we try to get the first element of ars[0]
then it gives us bracket where as in we need first element as compare to bracket so the better way to this is
var packing_slip_orders = JSON.parse('<?php echo json_encode($packing_slip_orders); ?>');
You should use json_parse
after json_encode
to get the accurate array result.