A simple example of retrieving the Country, State, City.
Enter your postal code!
<script type="text/javascript">
var client = new XMLHttpRequest();
client.open("GET", "http://zip.elevenbasetwo.com/v2/US/48867", true);
client.onreadystatechange = function() {
if(client.readyState == 4) {
alert(client.responseText);
};
};
client.send();
</script>
{"country": "US", "state": "Michigan", "city": "Owosso"}
Ziptastic supports a smattering of countries via their two-letter country code. Querying the new API looks like this:
Example: http://zip.elevenbasetwo.com/v2/US/48867
If you only deal with the US, you can still query the original Ziptastic API
Example: http://zip.elevenbasetwo.com/48867 and http://zip.elevenbasetwo.com/?zip=48867