Hi all,
I am new to AJAX technology.
I have tried to write a web app to retrieve the telephone number of some person and my code was :
<html ><head>
<script>
var xmlHttp;
function callServer()
{
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
var name =document.getElementById("name").value;
var sURL = "http://localhost/telephone.php?name="+name;
xmlHttp.open("GET",sURL,true);
xmlHttp.onreadystatechange = writeResponse; }
function writeResponse()
{
if(xmlHttp.readyState == 4)
{
var e = document.getElementById("number");
e.value = xmlHttp.responseText;
}
}
</script>
</head>
<body>
<div align="center">
<div align="center">
<table border="0" style="border-collapse: collapse" width="266" bordercolor="#FFFFFF" bordercolorlight="#000000" bordercolordark="#808080" bgcolor="#FFFFFF" dir="ltr" id="table1">
<tr>
<td width="79">Name</td>
<td><input id="name" type="text" name="name" size="20"></td>
<td width="74"><input type="button" value="Get" name="get" onclick="callServer()"></td>
</tr>
<tr>
<td width="79">Telephone</td>
<td><input id="number" type="text" name="number" size="20"></td>
<td width="74"> </td>
</tr>
</table>
</div>
<p> </div></body></html>
and when I tried to view it an error message apeared which is "Permission denied" pointing to the read line in the code , and I ca not find an answer plz help me.
I am using IE v 6.0