I am having all kinds of problems. :) Sorry guys. I am trying to build an AJAX automatic word search javascript. I have basically copied code from a book and tried it out. But I get and error. I will post my code and then explain more.
Can I ask what is the server enviornment you are running this on?
Thanks,
Eric
I lied. I tried it again and when I type too fast it throws that error. I tried it in IE and got no error.
I did a try catch as you suggested and it worked. I wish I knew what was going on though and how to fix it properly. Maybe I am not killing the HTTPRequest object correctly??
System:
Darwin Test-Servers-Computer.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh
function processReqChange() {
if (req.readyState == 4) {
if (req.status == 200 || req.status == 0) {
alert(req.responseText);
}
else {
try{alert("There was an issue retrieving the data:\n" +
"Reason: " + req.statusText);
}
catch(e){
alert("There was an issue retrieving the data");
}
}
}
}
One problem with cancelling the request with every keystroke is a fast typer will not see anything until they are done. I normally set a Timeout to wait XXXms and than fire a request off and when the request comes back, if the text is different, I fire off another request.
Eric
lol...I just wanted Apache...With Apache, when you do a post you NEED to set the Content-type request header. Others seem to be more forgiving!