I have an array $lines in php. Currently I want to assign the $lines value to a javascript variable(i.e. chartLines).
The way I assigned the php array to javascript is not correct.
Can anyone help me? Thanks in advance!
<?php
$line1 = array(array("08:00","20"),array("08:00","16"),array("08:00","19"),array("08:00","17"));
$line2 = array(array("08:00","45"),array("08:00","47"),array("08:00","49"),array("08:00","47"));
$lines= array($line1,$line2);
?>
<script type="text/javascript">
$(function () {
var chartLines = <?php echo $lines; ?>
});
var chartLines = <?php json_encode($lines); ?>;
<? $a=''; $a.='<script> function(){ var q=".$myArray.";'; ?>
etc