how to pass php array to javascript function?

by Ramya 2014-01-08 17:36:33

how to pass php array to javascript function?

In normal cases, we can't pass php array to javascript function with the exact value. In such cases, we can use json concept as,

echo '<li onclick="func('.json_encode($pushNo).')">'.$i.'<s/li>';


which you can retrieve as,
var temp = pushNo;
temp = pushNo.split('~');
for(i=0;i {
alert(temp[i]);
}


Razz
Razz
Razz
Razz
763
like
0
dislike
0
mail
flag

You must LOGIN to add comments