1. T.Y. BSc Computer Science
Practical No:- 10
Practical Name: Create a webpage using Ajax, having a text Box for accepting a number
check whether the number is even or odd using php and dispay the output.
Date: 04/02/2016
Source Code:
Evenno.php
<?php
$q=$_REQUEST["q"]; $hint="";
if ($q !== "")
{
if ($q%2==0)
echo "Even Number";
else
echo "odd Number";
}
else
echo $hint==="" ? "no suggestion" : $hint;
?>
Evenno.html
<html>
<head>
<script>
functionshowHint(str)
{
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
varxmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 &&xmlhttp.status==200)
{