Dear all,
I have done a sample program using ajax . But onreadystatechange not working. If i specifies "false" in the open method.
Example program :
<html>
<head><title>Sample Ajax File</title></head>
<script type="text/javascript">
function ajax_function(){
var httpReq = new XMLHttpRequest();
httpReq.onreadystatechange=function(){
alert(httpReq.readyState);
}
httpReq.open("GET","http://localhost/ajax/sample.php?name=prem&Id=1",false);
httpReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
httpReq.send(null);
}
</script>
<body>
<form name="frm" action="#" method="" >
<input type="button" value="Click me" name="" id="" onclick = "return ajax_function()">
</form>
</body>
</html>
If i have changed false into true . Then i the function onreadystatechange working.
Note: I am using mozilla browser.
Thank you,
With Regards,
Prem