Best case:
Use ajax.
<html>
<head>
<script type="text/javascript">
var xmlhttp = new Array;
var url = new Array;
// Create 3 instances.
for (var i = 0; i < 3; i++) {
xmlhttp[i] = new XMLHttpRequest;
}
var arr = ["ONE", "TWO", "THREE", "FOUR", "FIVE"];
// function which will run
// on button click.
function Run() {
var url1 = "test.php?w1=" + arr;
var url2 = "test1.php?w1=" + arr;
var url3 = "test2.php?w1=" + arr;
url = [url1, url2, url3];
for (var i = 0; i < 3; i++) {
xmlhttp[i].open("GET", url[i]);
xmlhttp[i].onreadystatechange = function() {
if (this.readyState == 4) {
document.write(this.responseText);
}
}
xmlhttp[i].send(null);
}
}
</script>
</head>
<body>
<input type="button" id="upload" value="RUN" onclick="Run();" />
<body>
</html>
Complex Solution:
use 4 iframes in the document. First keep them display none. Then on button click, open the url in all the iframes.
<html>
<head>
<script type="text/javascript">
var url = new Array;
var arr = ["ONE", "TWO", "THREE", "FOUR", "FIVE"];
// function which will run
// on button click.
function Run() {
var url1 = "test.php?w1=" + arr;
var url2 = "test1.php?w1=" + arr;
var url3 = "test2.php?w1=" + arr;
url = [url1, url2, url3];
var iframes = document.getElementsByTagName("iframe");
for (var i = 0; i < iframes.length; i++) {
iframes[i].src = url[i];
}
}
</script>
</head>
<body>
<input type="button" id="upload" value="RUN" onclick="Run();" />
<iframe style='display:none;'></iframe>
<iframe style='display:none;'></iframe>
<iframe style='display:none;'></iframe>
<body>
</html>
Another method:
In your server you can include other 2 files to a file.
here I have included test1.php and test2.php in test.php
<?php
var_dump($_GET["w1"]);
include "test1.php";
include "test2.php";
?>
html:
<html>
<head>
<script type="text/javascript">
var arr = ["ONE", "TWO", "THREE", "FOUR", "FIVE"];
// function which will run
// on button click.
function Run() {
window.location.href = "test.php?w1=" +arr;
}
</script>
</head>
<body>
<input type="button" id="upload" value="RUN" onclick="Run();" />
<body>
</html>