passage variable php -> js
Bonjour,
Je poss�de deux fichiers diff�rents a.php et b.php
Un formulaire dans a.php appel apr�s validation b.php avec une variable mavariable en param�tre.
Code:
1 2
|
self.location.href="http://localhost/b.php?mavariable="+mavariable; |
Sur la page b.php j'utilise du javascript ou il est n�cessaire de r�cup�rer la valeur de mavariable, comment faire ?
si dans b.php je fais :
Code:
1 2 3 4
| <?php
$mavariable = $_GET['mavariable'];
echo $mavariable;
?> |
la valeur s'affiche correctement par contre impossible de l'utiliser dans une fonction javascript.
Code:
1 2 3
| function recupvaleurvariable() {
//je sais pas faire
} |
Je sais que php s'ex�cute c�t� serveur et javascript c�t� client mais il doit y avoir un moyen de r�cup�rer ma variable.
merci