Bonjour, j'ai une liste déroulante et je voudrais qu'en fonction de ce que je choisis dans cette liste une table soit rempli avec différentes valeurs mais quand je choisi une option rien ne se passe et je n'arrive pas à comprendre pourquoi. Qulqu'un peut m'aider svp ?
La liste :
Requete Ajax :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <form name = "formulaire"> <select name = "formationVoulue" size = "1" onClick="envoiRequete()">' ; foreach($bdd->afficherNomSFormationS() as $key=>$formation) { echo'<option>'.$formation.'</option>' ; } echo' </select> </form><br><br> <!--div id="formationChoisie" style="width:850px ; height:220px ;display:block ; background-color:red"></div--> <table id="formationChoisie" border="1" width="45%"> <tr><td width="33%" align="center">Sequence</td> <td width="33%" align="center">Cours</td> <td width="33%" align="center">Ressource</td></tr> </table>
FormationVoulue.phpCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 function envoiRequete() { objetRequete = new XMLHttpRequest() ; for (i=1 ; i<=16 ; i++) { if (this.document.formulaire.formationVoulue.options[i-1].selected) { objetRequete.open("GET", "/groupoffice-com-3.5.7/modules/testmodule/classes/FormationVoulue.php?form="+i, true) ; objetRequete.onreadystatechange = traiteReponse ; objetRequete.send(null) ; } } } function traiteReponse() { objetRequete = new XMLHttpRequest() ; if (objetRequete.readyState == 4) {alert("aaa") ; document.getElementById("formationChoisie").innerHTML = objetRequete.responseText ; } }
Code:
1
2
3
4
5
6
7
8
9
10
11 <?php $choix = $_GET['form'] ; $_SESSION['choix'] = $choix ; foreach($bdd->afficherParcours() as $key=>$parcours) { echo'<tr><td width="25%" align="center">'.$parcours['Sequence'].'</td>'; echo'<td width="25%" align="center">'.$parcours['Cours'].'</td>'; echo'<td width="25%" align="center">'.$parcours['NomRessource'].'</td></tr>'; }
