Ajax Tutorial
- What is Ajax
- How Ajax Work
- ajax() and load() Function
- AJAX get() and post() Methods
- AJAX Function
- Ajax Success
- Ajax Button Click
- Ajax div load on button click
- Insert Data
- Delete Data
- User Registration
- ContactUs Form
- Check existing Password in Ajax and change the Password
- Ajax Search
- Ajax Serialize Insert
- Ajax without Searialize Insert
- Ajax User Check Availability
- Ajax OptionBox
- Ajax Dropdown Session
- dynamic text box Add/Remove
- Star Rating
- Pin Check Available
- Ajax Programs
- Clear Form Field after submitting form
- Loader load show / hide
- Multiple Functions
Customer Say
Pin Check Available
File name : index.php
<html>
<head>
<title>Indian pincode search with location and courier services</title>
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#check").click(function() {
var name = $('#name').val();
if(name=="")
{
$("#disp").html("");
}
else
{
$.ajax({
type: "POST",
url: "pin_check.php",
data: "name="+ name ,
success: function(html){
$("#disp").html(html);
}
});
return false;
}
});
});
</script>
</head>
<body>
<section>
<h1>Indian Pincode search with location and courier service</h1><br>
<center>
<form method="post">
<b style="color:white;">PINCODE SEARCH:</b>
<input style="height:40px; width:200px;" id="name" type="text" name="name" />
<input style="height:40px; width:70px; " id="check" type="submit" name="check" value="check" /><br />
</form>
</center>
<center>
<div class="tbl-content">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<h2><?php echo @$_GET['blank']; ?> </h2>
<div id="disp"></div>
</tbody>
</table>
</div>
</center>
</section>
</body>
</html>
File name : pin_check.php
<?php
$con = mysqli_connect("localhost","root"," ","indianpincode");
if(isset($_POST['name']))
{
$name=$_POST['name'];
$get="select * from Pincode where pincode='$name' ";
$query=mysqli_query($con,$get);
$row=mysqli_num_rows($query);
if($row==0)
{
echo "<h2 style='color:white;' >
Courier Company are not providing delivery services at this Pincode:
<span style='color:red;'>$name</span></h2>";
}
else{
echo"
<tr style='width:100%'>
<td style='width:15% color:#f51c4f;'><h3 style='color:black;'>PINCODE</h3></td>
<td style='width:15%'><h3 style='color:black;'>COURIER COMPANY</h3></td>
<td style='width:15%'><h3 style='color:black;'>CITY NAME</h3></td>
<td style='width:15%'><h3 style='color:black;'>STATE NAME</h3></td>
<td style='width:15%'><h3 style='color:black;'>STATE CODE</h3></td>
<td style='width:15%'><h3 style='color:black;'>COD</h3></td>
</tr>";
while($row1 = mysqli_fetch_array($query)){
$pincode = $row1['pincode'];
$courier = $row1['courier_company'];
$cityname = $row1['city_name'];
$statename = $row1['state_name'];
$statecode = $row1['state_code'];
$status = $row1['cod'];
echo"
<tr style='width:100%'>
<td style='width:15%'>$pincode</td>
<td style='width:15%'>$courier</td>
<td style='width:15%'>$cityname</td>
<td style='width:15%'>$statename</td>
<td style='width:15%'>$statecode</td>
<td style='width:15%'>$status</td>
</tr>";
}
}
}
?>
File name : index.php