Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Rengaraj
2k
1
3.1k
Onchange event in php with ajax
Jan 5 2013 9:22 PM
code:<html>
<head>
<script>
function showUser(str)
{
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").outerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getuser.php?id="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="id" onChange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">1</option>
</select>
</form>
<br>
</body>
<div id="txtHint"><b></b></div>
</html>
<?php
if(isset($_GET['id']))
{
echo "this is id". $_GET['id'];
}
?>
Question:
The result is create with another one listbox. how to avoid that?
Reply
Answers (
1
)
i want to hide some dropdown on selection of dropdown.
send mail from localhost in php