Transformer un tableau PHP en tableau Javascript
Posté : 24 sept. 2008, 16:33
Bonjour,
Je crée un nouveau sujet, car j'ai trouvé la solution à mon problème précédent.
Mais ce nouveau problème est toujours lié à l'application sur laquelle je travaille.
J'ai un fichier PHP getPrices.php, qui me renvoie le tableau PHP suivant :
Ce fichier PHP est appelé via AJAX :
J'aimerai transformer ce tableau PHP reçu par Javascript en tableau Javascript de même forme :
Comment dois-je m'y prendre ?
Je crée un nouveau sujet, car j'ai trouvé la solution à mon problème précédent.
Mais ce nouveau problème est toujours lié à l'application sur laquelle je travaille.
J'ai un fichier PHP getPrices.php, qui me renvoie le tableau PHP suivant :
Code : Tout sélectionner
Array ( [100] => 10 [151] => 14 [201] => 18 [251] => 22 [301] => 26 [351] => 30 [401] => 34 [451] => 38 )Code : Tout sélectionner
var pricesNoLight10 = creerXHR('getPrices.php?price_type='+ type);Code : Tout sélectionner
pricesNoLight10[100] = 10;
pricesNoLight10[151] = 14;
pricesNoLight10[201] = 18;
pricesNoLight10[251] = 22;
pricesNoLight10[301] = 26;
pricesNoLight10[351] = 30;
pricesNoLight10[401] = 34;
pricesNoLight10[451] = 38;