simpleAjax.html
<html>
<body>
<script type="text/javascript" >
function ajaxfunction(){
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
document.timeform.time.value=xmlhttp.responseText;
}
}
xmlhttp.open("GET","simpleajax.php",true);
xmlhttp.send(null);
}
</script>
<form name="timeform" >
Name:<input type="text" name="Name" onkeyup="ajaxfunction()"; /><br/>
Time:<input type="text" name="time"/>
</form>
</body>
</html>
simpleAjax.php
<?php
echo ($SERVER_ADDR);
?>
|