Category Archives: API

Get Address by postcode(Google Geocoding API)

Sometimes we need the address against postcode or need postcode against address. Google geocoding API provides this way correctly.

Suppose you have a text box and a button

<input type=”text” name=”location” id=”location” />
<input type=”button” name=”show” value=”show address” id=”show-add” />

Then it can be done by following script. I used here geocode v3.

<script type=”javascript/text” >
var location = $(‘#location’).val();

function getAddress(location){
geocoder = new google.maps.Geocoder();
geocoder.geocode( { ‘address’: location }, function(results, status) {
if (status == ‘OK’) {

} else {

alert(“Geocode was not successful for the following reason: ” + status);


for more informaton see this link :

We can do this by v2 too but in v2 api_key is needed.

function getAddress(location){
$.getJSON(“”+location+”key=”+googleApi+”&sensor=false&output=json&callback=?&#8221;,function(data, textStatus){
$.each(data.Placemark, function(key, val) {

Leave a comment

Posted by on January 17, 2012 in API, javascript, jQuery


Tags: , , ,