Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/11/2010, 16:39
mandarinformacion
 
Fecha de Ingreso: noviembre-2010
Mensajes: 8
Antigüedad: 13 años, 6 meses
Puntos: 0
Leer array de php en javascript

Hola tengo el siguiente array php que cargo asi ;

Código PHP:

(while)
{
$titulos[$f] = $row ["title"];
              $textos[$f] = $row ["comment"];
          $urls[$f] = $row ["id"];
              $pics[$f] = $row ["image_id"];
              $f++;

}

Luego abro el script de java 

<script>
var text=new Array()
var textlink=new Array()
var texttarget=new Array()
var $b = <?php echo $f?>;

//Creo un bucle for

var $i=0; 

for ($i=0;$i<=$b-1;$i++) {
text[$i]="<?php echo $titulos[$i]; ?> <?php echo $textos[$i]; ?>"
document.write($i) 
document.write("<br>") 
}
He intento leer los datos del array $titulos[] me aparece solo 1 de los titulos de los 2 titulos que contiene el array en php.

he puesto el document.write($i) para controlar cuantas veces hace el for y lo hace las 2 veces.

Gracias por vuestra ayuda.