Right. Lets bug hunt.
Code:
function showUser(str,str1)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","user1.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a person/option>
<option value="15">15</option>
<option value="2">Lois Griffin</option>
<option value="3">Glenn Quagmire</option>
<option value="4">Joseph Swanson</option>
</select>
<select name="users1" onchange="showUser(this.value)">
<option value="">Select a person/option>
<option value="1">1</option>
Problem #1:
Code:
<select name="users1" onchange="showUser(this.value)">
Code:
function showUser(str,str1)
You're submitting one value to a function that expects 2 parameters.
I wouldnt actually submit any values as parameters, and instead use the getElementById (and then give the selects ID's) to pull the data on change.
Problem #2:
Code:
xmlhttp.open("GET","user1.php?q="+str,true);
Where's your second value in that url string?
Bookmarks