Home > Web Code, Work > I ({‘JSON’:'Heart’});

I ({‘JSON’:'Heart’});

August 5th, 2009


For those of us who are too lazy to parse XML, JSON is a great Web data format. And the fact that it can get around all sorts of cross-domain restrictions*.

I just posted a simple JSON-enabled HTML web page that accepts a zip code, and retrieves longitude and latitude from a Geonames JSON feed, and then uses that to look up the weather from the nearest weather station. I love the fact that this is possible without a single line of server-side code. The code rewrites the page’s DOM, dynamically appending a <script> tag to the page, and doesn’t use any of the standard AJAX functions.

Cross-Domain AJAX JSON Example

Fancy Cross-Domain AJAX JSON Example

Next up: a clickable map that will figure out your country and timezone. This functionality will solve about a dozen headaches I’ve been having with adding a selectable timezone feature to my FlipClock Firefox extension.

*Yes, there are many, many caveats that go along with to this statement

Web Code, Work

  1. No comments yet.
  1. No trackbacks yet.