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
| <script>
/** Fonction AJAX traitant l'appel fichiers **/
function file(fichier) {
if(window.XMLHttpRequest) // Pour Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Pour IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
return(false);
//On lance le fichier
xhr_object.open("GET", fichier, true);
xhr_object.send(null);
if(xhr_object.readyState == 4)
return(xhr_object.responseText);
else
return(false);
}
</script>
<?php
$uri = "http://localhost/script/";
$script = array('script_1.php', 'script_2.php', 'script_3.php');
foreach($script as $value) {
$file_src = "";
$file_src = $uri.$value;
?>
<script>
file('<?php echo $file_src; ?>');
</script>
<?php
}
?> |
Partager