Push PHP Variable to Javascript Array -


i want push php variable javascript. code below not seem work. can show me how this?

ticks.push(<?php echo json_encode($new); ?>); 

is you're looking for?

ticks.push(json.parse('<?= json_encode($new); ?>')); 

or broken down:

var json = '<?= json_encode($new); ?>'; var obj = json.parse(json); ticks.push(obj) 

also addressed in issue:

accessing array in php javascript/jquery


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -