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

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -