Salut,

C'est une question plusieurs fois répété, mais je suis toujours sans idée s'il est possible.
Le fichier start_mp.php produit 10 numéros:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<?php
 
$rand_a = array();
for ($i = 1; $i <= 10; ++$i)
{
        array_push($rand_a, rand(1, 100));
        sleep(1);
}
print_r($rand_a);
?>
Le fichier test.php réalise quatre Ajax requêtes à start_mp.php pour obtenir ces 10 numéros:
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
<html>
	<head>
		<script>
			function AJAXInteraction(url, callback) 
			{
				var req = init();
				req.onreadystatechange = processRequest;
 
				function init() 
				{
					if (window.XMLHttpRequest) 
					{
						return new XMLHttpRequest();
					} 
					else if (window.ActiveXObject) 
					{
						return new ActiveXObject("Microsoft.XMLHTTP");
					}
				}
 
				function processRequest () 
				{
					if (req.readyState == 4 && req.status == 200) 
					{
						if (callback)
						{
							callback(req.responseText);
						}
					}
				}
 
				this.doGet = function() 
				{
					req.open("GET", url, true);
					req.send();
				}
 
				this.doPost = function(body) 
				{
					req.open("POST", url, true);
					req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					req.send(body);
				}
			}
 
			function makeRequest(accountNo) 
			{
				var ai = new AJAXInteraction("start_mp.php", function(txt)
					{
						var txtProcessingId = "txtProcessingMP" + accountNo;
						document.forms["frmMP"].elements[txtProcessingId].value = txt;
					}
				);
				ai.doGet();
			}
		</script>
	</head>
	<body>
		<form name="frmMP" method="post" action="index.php" enctype="multipart/form-data">
		<?php
                        for ($i = 0; $i < 4; ++$i)
                        {
                                echo "<p>Processing:" .
                                        "<input type=\"text\" name=\"txtProcessingMP" . ($i + 1) . "\" />" .
                                        "<input type=\"button\" value=\"start\" onClick=\"makeRequest(" . ($i + 1) . ")\">" .
                                        "</p>";
                                
                        }
                ?>
		<input type="submit" name="continue" value="continue" />
		</form>
	</body>
</html>
Firefox/Chrome synchronisent des requêtes, mais je veux les obtenir en même temps. Est-ce que c'est possible?