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>
<head>
<script type='text/JavaScript'>
function maFonctionAjax()
{
var MonAjax;
if (window.XMLHttpRequest)
{
// Mozilla, Safari, ...
MonAjax = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// IE
MonAjax = new ActiveXObject('Microsoft.XMLHTTP');
}
else
{
alert("Votre navigateur n'est pas adapté pour faire des requêtes AJAX...");
MonAjax = false;
}
MonAjax.open('GET',"txt.txt",true);
MonAjax.onreadystatechange = function()
{
if (MonAjax.readyState == 4 && MonAjax.status == 200)
{
document.getElementById('ma_div').innerHTML = MonAjax.responseText;
}
}
MonAjax.send(null);
}
</script>
</head>
<body>
<div id="ma_div"></div>
</body>
</html> |