This Your INDEX.HTML page
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
var str=document.search.name.value;
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","details.php?name="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form name="search">
<input type="text" name="name">
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</form>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
</body>
</html>
Create Mysql database with name Details
create table details(name text(10), phone number(12), address text(50));
This Is your server page details.php
<?php
$name=$_GET['name'];
$sql="select * from details where name='$name'";
$r=mysql_query($sql) or die("error".mysql_error);
while($row=mysql_fetch_array($r)){
echo("name".$row['name']."<br>");
echo("phone".$row['phone']."<br>");
echo("address".$row['address']);
}
?>
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
var str=document.search.name.value;
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","details.php?name="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form name="search">
<input type="text" name="name">
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</form>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
</body>
</html>
Create Mysql database with name Details
create table details(name text(10), phone number(12), address text(50));
This Is your server page details.php
<?php
$name=$_GET['name'];
$sql="select * from details where name='$name'";
$r=mysql_query($sql) or die("error".mysql_error);
while($row=mysql_fetch_array($r)){
echo("name".$row['name']."<br>");
echo("phone".$row['phone']."<br>");
echo("address".$row['address']);
}
?>