PHP string array to javascript string array parsing error -
i've tried
var name = <?php echo json_encode($eventname); ?>;
and
var name = new array("<?php echo implode('","', $eventname);?>");
to parse name string array php javascript. displayed
var name = ["lalalala","lalala","test"];
and
var name = new array("lalalala","lalala","test");
in viewsource, when tried use name[i] string, returned character, not string. size of array name not 3, 20 (which total number of characters plus 3 ","). how can fix this?
pretty sure because 'name' points window.name (thanks fabrÃcio matté). look here
it works fine if change 'name' 'names'.
Comments
Post a Comment