I have a php array that consists of 4 string elements :
$arr = Array("A", "B", "C", "D");
i want to pass this array as an argument to a javascript function and alert the contents, how ? so i need something like this in javascript:
I do not want a solution like this : function ('<?=$arr?>') { ... }
whenever I try to pass it, the alert function of javascript displays the word "ARRAY" ...
thanx in advance ..
$arr = Array("A", "B", "C", "D");
i want to pass this array as an argument to a javascript function and alert the contents, how ? so i need something like this in javascript:
Code:
function x(my_arr) {
for(i=0;i<my_arr.length;i++)
alert(my_arr[i]);
}
whenever I try to pass it, the alert function of javascript displays the word "ARRAY" ...
thanx in advance ..
Comment