I am searching in this page for an answer to my question, but I dont found it.
<script type="text/JavaScript">
var jsarray= [];
<?php
include("conectar.php");
if (isset($_GET['selector'])) $condicion = ' WHERE clave=' . $bd->quote($_GET['selector']);
else $condicion = '';
$pet = $bd->prepare("SELECT * FROM Calendario" . $condicion);
$pet->execute();
$filas = $pet->fetchAll();
$arrayF=array();
$arrayU=array();
print '<table class="gridtable">';
foreach ($filas as $fila)
{
//print '<tr><td>'.$fila['Fecha'] . '</td><td>' . $fila['URL'] . '</td></tr>';
array_push($arrayF,$fila['Fecha']);
array_push($arrayU,$fila['URL']);
}
for ($i=0 ;$i < count($arrayF); $i++){
echo 'jsarray['.$i.'] = "'.$arrayF[$i].'";';
}
?>
window.onload=function(){
alert(jsarray);
}
</script>
I am accesing to a database, getting some data and the, putting into arrayF and arrayU. Then, i have to do to send the array to the JavaScript to work with them. But this dont work. I dont know why, but when I execute it, dont show me nothing, but the arrays in php are with elements, I am sure of this, beacause
Anyone knows why occurs this?