I'm learning AJAX myself and my code is

<html>
<head>
<script>
function callAjax()
{
var xmlreq = new XMLHttpRequest(); // since i'm using Mozilla
var url = "http://localhost/naga/get_details.php?name=naga";
var ope;
ope = xmlreq.open('GET',url,true);
alert(ope); // here i'm getting as 'undefined'
xmlreq.onreadystatechange = myFunc();
function myFunc()
{
if (xmlreq.readyState==4)
{
document.getElementById('one').innerHTML=xmlreq.responseText;
}
}
xmlhttp.send();
}
</script>
</head>
<body>
<div id="one">Microsoft</div>
<input type="button" onclick="callAjax()" value="Change link">

</body>
</html>