<html>
<head>
<script>
function submitform()
{
document.getElementById("ajax_data").innerHTML = "";
if(window.XMLHttpRequest) // Autres
{
var xhr_object = new XMLHttpRequest();
}
else if(window.ActiveXObject) // IE6
{
var xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr_object.onreadystatechange = function()
{
if(xhr_object.readyState == 4)
{
if(xhr_object.status == 200)
{
document.getElementById("ajax_data").innerHTML = xhr_object.responseText;
}
}
};
xhr_object.open("GET", "hello.txt", true);
xhr_object.send(null);
}
</script>
</head>
<body>
<form method="post" name="ajax" action="">
<input type="button" value="Envoyer" onclick="submitform()">
</form>
<div id="ajax_data"></div>
</body>
</html>