<html>
<head>
<script language=javascript>
<!--
var xmlHttp;
function showHint()
{
//alert("gfsdf12");
str=document.getElementById("txt1");
//alert("gfsdf");
if (str.value.length==0)
{
document.getElementById("txtHint").innerHTML="nothing"
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="http://localhost:8080/aspfiles/test.asp"
url=url+"?q="+str.value
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
else {
//alert("df");
document.getElementById("txtHint").innerHTML="Error " + xmlHttp.status;
//setTimeout('showHint()', 10);
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
-->
</script>
</head>
<body>
<form ID="Form1">
First Name:
<input type="text" id="txt1"
onblur="showHint();" NAME="txt1">
<p>Suggestions: <span id="txtHint"></span></p>
</form>
</body>
</html>
my test.asp has :
This is $Tomcatbase/aspfiles/test.asp
works when i type http://localahost:8080/aspfiles/test.asp in f.fox
<% Response.Write("Hello World!") %>