Bonjour,
pouvez-vous me dire pourquoi ce code ne fonctionne pas sous IE, et comment le faire fonctionner ?
sous Firefox, j'ai bien:
Code text : 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 submit un 1 1 2 3 4 200 un submit deux 1 1 2 3 etc.. 4 200 quatre terminé
alors que sous IE, la page s'arrête sur "submit deux"
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
49
50
51
52
53
54 <?php $q = &$_REQUEST['q']; if (isset($q)) die($q); ?> <html> <head> <script type="text/javascript"> var liste = ['un', 'deux', 'trois', 'quatre']; var index = 0; var ajax; function log(str) { document.body.appendChild(document.createTextNode(str)); document.body.appendChild(document.createElement('BR')); } function submitAjax() { if (index < liste.length) { log('submit ' + liste[index]); ajax.open('GET', 'test.php?q=' + liste[index], true); index++; ajax.send(null); } else { log('terminé'); } } if (window.XMLHttpRequest) ajax =new XMLHttpRequest(); // Firefox else { if (window.ActiveXObject) ajax =new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer else throw("Votre navigateur ne supporte pas AJAX !"); } ajax.onreadystatechange = function() { log(ajax.readyState); if (ajax.readyState == 4) { log(ajax.status); if (ajax.status == 200) { log(ajax.responseText); submitAjax(); } else { log(ajax.status); } } } </script> </head> <body onLoad="submitAjax()"> </body> </html>
Partager