Hi Im trying to send an array from php to my javascript. Is this possible? Ive tryied a few examples that Ive found but non of them have worked.
Here is what Im trying to do:
php file:
<?php
$n = array('test','test2', 'test3');
<script type='text/javascript'>
initArray($n);
</script>
?>
javascipt:
function initArray(array){
for(var i = 0; i < array.length; i++){
alert(array[i]);
}
}
Thx for all your answers