$.getJSON

The API:

http://api.openweathermap.org/data/2.5/weather?q=Macau,MO

Viewing JSON output directly in web browser often comes without any formatting and make the data inspection difficult. We can make use of JSON formatter tools. Here just to name few. There are tons of them.

  1. rested
  2. visual JSON
  3. browser extension

Rested open weather map

In jQuery, we use $.getJSON for this purpose.

1;(function($){
2  $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=Macao,MO', function(data){
3    console.log(data);
4  });
5}).call(this, jQuery);

What’s next? We’re going to take a look at “Parse JSON”.

overlaied image when clicked on thumbnail

Makzan | Mobile web app dev with phonegap | Table of Content