<html>
<body>
<script language="javascript" type="text/javascript" >
function send_with_ajax(){
if (window.XMLHttpRequest || window.ActiveXObject) {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(exception) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
xhr = new XMLHttpRequest();
}
} else {
alert("Your browser does not support XMLHTTP Request...!");
}
xhr.open("GET", "ajax_demo.txt", true); // Make sure file is in same server
xhr.send(null);
xhr.onreadystatechange = function(){
document.getElementById("textArea").value = xhr.responseText;
};
}
</script>
<button onClick="send_with_ajax()">Get Contain</button>
<br />
<textarea id="textArea" cols="40" rows="5"></textArea>
</body>
</html>