<html>
<head>
<title>Test Ajax</title>
<script type="text/javascript">
function changeCon(){
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHttp");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
//first we need to initialize the object.
//then we define this function = onreadystatechange;
//check status;
xmlhttp.open("GET","info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="myDiv">
<h1>Hello Ajax, Let's Change the Content!</h1>
</div>
<input type="button" value="change" οnclick="changeCon()" />
</body>
</html>
<head>
<title>Test Ajax</title>
<script type="text/javascript">
function changeCon(){
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHttp");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
//first we need to initialize the object.
//then we define this function = onreadystatechange;
//check status;
xmlhttp.open("GET","info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="myDiv">
<h1>Hello Ajax, Let's Change the Content!</h1>
</div>
<input type="button" value="change" οnclick="changeCon()" />
</body>
</html>