Hellow i have the following files
body.html
data.php
js3.js
I am trying to create an ajax search but it doesnt work....:(
The js code is:
var xmlHttp
function finding(str){
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
try {
xmlhttp = new XMLHttpRequest()
}catch (e) {
alert("Browser does not support HTTP Request")
return
}
var url="data.php"
url=url+"?productname="+str
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("result").innerHTML=xmlHttp.responseText
}
}
function stateChanged()
{
if(xmlHttp.readyState==4|| xmlHttp.readyState=="complete")
{
document.getElementById("result").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
}
The html code containes:
<script src="js3.js"></script>
</head>
<body>
<form>
search:
<input type="text" size="30" onkeyup="finding(this.value)"/>
</form>
<p><div id="Result"></div>
</p>
</body>
</html>
Pls need some help!!!tnx