I want to pass javascript array(converted from php to js) present in php code to javascript function.
<?php
//php to javascript array conversion
$php_array = array('he','hi','hello');
$js_array = json_encode($php_array);
echo 'var groups = ". $js_array . ";\n';
?>
function codeAddress(groups)
{ alert("into code address function");
for (var i=0;i<groups.length;i++)
{
alert(groups[i]);
}
}
"
and'
. So you're not actually setting your js variable to what you expect. – bcmcfc Jun 27 at 13:15