<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote>
main_page.php</blockquote>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<script language="javascript" src="createObj.js" type="text/javascript"></script>
<script type="text/javascript">
function showData()
{
var xmlhttp = createObj();
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("div").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","sample.html",true);
xmlhttp.send();
}
</script>
</head>
<body>
<h1>
AJAX With MySQL</h1>
<input name="category" onclick="showData()" type="radio" value="Camera" />Camera<br />
<input name="category" onclick="showData()" type="radio" value="Mobile" />Mobile<br />
<div id="div" style="background-color: #dddddd; height: 300px; width: 500px;">
</div>
</body>
</html>
<br />
<blockquote>
showdata.php</blockquote>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<style type="text/css">
table
{
background-color:#2A2A2A;
color:#FFF;
}
</style>
</head>
<body>
';
while($r = mysql_fetch_array($query))
{
echo '
<tr><th>Name</th><td>'.$r["name"].'</td></tr>
<tr><th>ID</th><td>'.$r["id"].'</td></tr>
<tr><th>Company</th><td>'.$r["company"].'</td></tr>
';
}
echo '</body></html>';
?>
<br />
<blockquote>
createObj.js</blockquote>
// JavaScript Document
function createObj()
{
var http;
if(window.XMLHttpRequest)
{
http = new XMLHttpRequest();
}
else
{
http = new ActiveXObject("Microsoft.XMLHTTP");
}
return http;
}
</div>
<blockquote>
main_page.php</blockquote>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<script language="javascript" src="createObj.js" type="text/javascript"></script>
<script type="text/javascript">
function showData()
{
var xmlhttp = createObj();
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("div").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","sample.html",true);
xmlhttp.send();
}
</script>
</head>
<body>
<h1>
AJAX With MySQL</h1>
<input name="category" onclick="showData()" type="radio" value="Camera" />Camera<br />
<input name="category" onclick="showData()" type="radio" value="Mobile" />Mobile<br />
<div id="div" style="background-color: #dddddd; height: 300px; width: 500px;">
</div>
</body>
</html>
<br />
<blockquote>
showdata.php</blockquote>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<style type="text/css">
table
{
background-color:#2A2A2A;
color:#FFF;
}
</style>
</head>
<body>
';
while($r = mysql_fetch_array($query))
{
echo '
<tr><th>Name</th><td>'.$r["name"].'</td></tr>
<tr><th>ID</th><td>'.$r["id"].'</td></tr>
<tr><th>Company</th><td>'.$r["company"].'</td></tr>
';
}
echo '</body></html>';
?>
<br />
<blockquote>
createObj.js</blockquote>
// JavaScript Document
function createObj()
{
var http;
if(window.XMLHttpRequest)
{
http = new XMLHttpRequest();
}
else
{
http = new ActiveXObject("Microsoft.XMLHTTP");
}
return http;
}
</div>
This comment has been removed by the author.
ReplyDeleteVery Nice It Is Very Helpful Post For Me About Java AndIEEE Engineering Projects So Thank You For Posting And Sharing With US
ReplyDelete