Skip to content

Instantly share code, notes, and snippets.

@rominirani
Created July 27, 2013 16:31
Show Gist options
  • Save rominirani/6095365 to your computer and use it in GitHub Desktop.
Save rominirani/6095365 to your computer and use it in GitHub Desktop.
Indian Pincode App - index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>India Pincodes</title>
<link rel="stylesheet" href="jquery.mobile-1.3.1.min.css" />
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.mobile-1.3.1.min.js"></script>
<script>
$(document).ready(function(){
//Invoke Pincode Search API
$("#btnSearch").click(function(){
pincode = $("#searchCriteria").val();
var xhr = new XMLHttpRequest({mozSystem: true});
xhr.open("GET", "http://pin-codes.in/api/pincode/" + pincode, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
obj = JSON.parse(xhr.responseText);
result = "<li>Post Office: " + obj.PostOffice + "</li>";
result += "<li>District: " + obj.District + "</li>";
result += "<li>State: " + obj.State + "</li>";
console.log(result);
$("#searchResults").html(result);
$('#searchResults').listview('refresh');
}
}
xhr.send();
});
});
</script>
</head>
<body>
<!-- Start of first page: #home -->
<div data-role="page" id="home">
<div data-role="header" data-position="fixed">
<h3>India Pincodes</h3>
</div><!-- /header -->
<div data-role="content">
<input type="search" id="searchCriteria" value="" placeholder="Enter Pincode" autofocus/>
<a href="#" id="btnSearch" data-role="button">Search</a>
<div id="linebreak">&nbsp;</div>
<ul data-role="listview" id="searchResults">
</ul>
</div><!-- /content -->
</div><!-- /page home -->
</body>
</html>
@gaurknp
Copy link

gaurknp commented Sep 22, 2020

can you help make pin code web page in blogger (XML)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment