Bonjour,
Pour ceux qui ont lu mes post de la journée je travaille sur XHR et j'ai quelque problème. J'ai enfin reussi à faire un code qui marche ou presque. Voici mon code dans ma page. Il fonctionne a part le status qui pour une obscur raison ne se remplit pas...
la page ne contitn pas grand chose
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 <html> <!-- Date de création: 26/04/2006 --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> <script type="text/javascript" src="../JavaScript/XHR.js"></script> <script langage="javascript"> function hapinessIsFree() { if (xmlhttp.readyState == 4) /* 4 : état "complete" */ { alert('niveau 4 '); if (xmlhttp.status == 200) alert(xmlhttp.responseText); else alert( xmlhttp.status+' '+xmlhttp.statustext); } } function Init() { xmlhttp=Init_XHR(); if(xmlhttp==null) { alert('probleme'); return; } xmlhttp.open("GET", "../Test/Test.php",true); xmlhttp.onreadystatechange=function(){ hapinessIsFree(); } } function event_call() { xmlhttp.send(null); } </script> </head> <body onload="Init();"> <form name="choiceForm"> <input type="button" name="button_req" value="TRY" onclick="event_call();"> </form> </body> </html>
Je remercie ceux qui aurait une idée pour résoudre ce problème si 'il veult bien proposer leur solution. La fonction init_xhr initialise l'objet et est de moi ... Visiblement elle marche
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <?php echo salut; ?>
Partager