Basic Example of a Postcode Lookup
Set the options
- postcode = display postcode in the output
- blank = include blank or null fields in the output
- country = include country in the output
- key = api key to be able to use the API
To use your API key, you must register an IP Address.
To use the API we require you register a free account and create a free API key.
<!DOCTYPE html>
<html>
<head>
<title>Free Postcode / Address Lookup</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<script>
$(document).ready(function(){
var options = { postcode: 0, blank: 0, country: 0, key: 0 };
$.ajax({
url:"https://www.freepostcode.co.uk/api/",
data: {postcode:"SW1A2AL",opts:options},
type:"POST",
dataType:"JSON",
success: function(r) {
$(".result").html(JSON.stringify(r));
}
});
});
</script>
<div class='result'>Result Here</div>
</html>
The result will return in JSON, you can then use this in your page.
For more details on the API please log into your account