<html>
<head>
<script language="JavaScript" type="text/javascript">
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>
<style type="text/css">
#ajax_data {
border:1px solid red;
height:32px;
width:100px;
}
</style>
</head>
<body>
<form method="post" name="ajax" action="">
<input type="button" value="Envoyer" onclick="submitform()">
</form>
<div id="ajax_data" ></div>
</body>
</html>