Forum Moderators: open
The html is:
<html>
<head>
<script type="text/javascript" src="clienthint.js" ></script>
</head>
<body>
<form>
First Name:
<input type="text" id="txt1"
onkeyup="showHint(this.value)">
</form>
<p>Suggestions: <span id="txtHint"></span></p>
</body>
</html>
In this script, showHint(this.value) is a function defined in clienthint.js.
The Javascript is listed below:
var xmlHttp
function showHint(str)
{
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="gethint.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
In Errorlog file:
Sun Sep 10 18:37:36 2006] [notice] Parent: Received restart signal -- Restarting the server.
[Sun Sep 10 18:37:36 2006] [notice] Child 1384: Exit event signaled. Child process is ending.
[Sun Sep 10 18:37:36 2006] [notice] Apache/2.0.59 (Win32) configured -- resuming normal operations
[Sun Sep 10 18:37:36 2006] [notice] Server built: Jul 27 2006 15:55:03
[Sun Sep 10 18:37:36 2006] [notice] Parent: Created child process 3344
[Sun Sep 10 18:37:36 2006] [notice] Child 3344: Child process is running
[Sun Sep 10 18:37:37 2006] [notice] Child 1384: Released the start mutex
[Sun Sep 10 18:37:37 2006] [notice] Child 3344: Acquired the start mutex.
[Sun Sep 10 18:37:37 2006] [notice] Child 3344: Starting 250 worker threads.
[Sun Sep 10 18:37:38 2006] [notice] Child 1384: Waiting for 250 worker threads to exit.
[Sun Sep 10 18:37:38 2006] [notice] Child 1384: All worker threads have exited.
[Sun Sep 10 18:37:38 2006] [notice] Child 1384: Child process is exiting
[Sun Sep 10 18:37:44 2006] [error] [client 128.189.138.12] C:/Program Files/Apache Group/Apache2/htdocs/clienthint.js is not executable; ensure interpreted scripts have "#!" first line, referer: [128.189.138.12...]
[Sun Sep 10 18:37:44 2006] [error] [client 128.189.138.12] (9)Bad file descriptor: don't know how to spawn child process: C:/Program Files/Apache Group/Apache2/htdocs/clienthint.js, referer: [128.189.138.12...]
In accesslog file:
128.189.138.12 - - [10/Sep/2006:18:37:44 -0700] "GET / HTTP/1.1" 304 -
128.189.138.12 - - [10/Sep/2006:18:37:44 -0700] "GET /clienthint.js HTTP/1.1" 500 617
I hope this kind of information could help.
http://www.example.com/clienthint.js
what happens if you specify a fully qualified url for the included javascript file?
<script type="text/javascript" src="http://www.example.com/clienthint.js" ></script>
I tried it. It retured "The server encountered an internal error or misconfiguration and was unable to complete your request."
You know, I also tried http://www.example.com/phptest.php. And it works.
will apache serve it to your browser?
Yes.
what happens if you specify a fully qualified url for the included javascript file?
<script type="text/javascript" src="http://www.example.com/clienthint.js" ></script>
I tried it also could not work. Here I placed both phptest.php and clienthint.js under htdocs directory of Apache HTTP server.