Certains ont voir ce code:JSON exportés sous forme de chaîne (non tableau)
<?php
echo stripslashes(json_encode(glob("photos-".$_GET["folder"].'/*.jpg')));
?>
il écho une chaîne parfaite vraiment sympa comme ça:
["photos-animaux/ani-01.jpg","photos-animaux/ani-02.jpg","photos-animaux/ani-02b.jpg","photos-animaux/ani-03.jpg","photos-animaux/ani-04.jpg","photos-animaux/ani-05.jpg","photos-animaux/ani-06.jpg","photos-animaux/ani-07.jpg","photos-animaux/ani-08.jpg","photos-animaux/ani-09.jpg","photos-animaux/ani-10.jpg","photos-animaux/ani-11.jpg","photos-animaux/ani-12.jpg","photos-animaux/ani-13.jpg","photos-animaux/ani-14.jpg"]
Avec encode JSON il shoul envoyer un tableau si variable [0] = doit aux photos-animaux/ani-01.jpg
maintenant il est seulement le caractère fisrt de la chaîne ..
comment un tableau est converti en chaîne, et comment dans javascipt pour convertir la chaîne en tableau pour pouvoir obtenir la valeur [0] [1] etc.
la question est QUAND ou POURQUOI le tableau parfait est converti en chaîne en tous cas ?
Ne faites pas cela, utilisez une bibliothèque JSON qui évaluera les données en toute sécurité, n'exécuter aucun code. –