Get JSON/XML/PHP then use data in page

Im wanting to use wunderground PWS (personal weather station) data in a custom page.
I don’t need to use all the data in the json/php/xml file, or which one is best for whats needed.

Using “api.wunderground.com/api/(API KEY)/conditions/q/pws:(STATIONID).(json/php/xml)” to get the current data, how would i implement this in to a page?

Here’s a generator for widgets that contains that data: http://www.wunderground.com/stickers/

Otherwise, you’ll need to use some sort of JavaScript function load, parse, and display that data.

Thanks for that, I’ve seen the widgets but they aren’t what I’m trying to achieve.

Are you able to point me to any kind of template that would help?

Once i understand how to get the data, praise and display it i have no problem building the page.

Hi @Thomas

Here is an jQuery ajax call to get the info from your url (don’t forget to include your key where it says “Your_Key”). *Note I used a url from the examples at api.wunderground.com

If you place this in a html widget you can then present the response information wherever you need. I guess you could include this in the Head HTML too if you prefer.

D

If i was to place this in the head html for the initial query, to get all the data in the one call.

How would i have say, up to 20 bits of data extracted and displayed in their own format?

Eg, would i have say 20 html widgets with their own script in them to display the data in each widget?

Hi @Thomas

Within the (warning pseudo code):

.done (function(data) {
    var myVar = document.getElementById("myID");
    myVar.innerHTML = "whatever data you want returned"; // in a object call like data.response.termsofService;
}

you would store your information or present it like above inside an element. You could do this with however many elements and bits of data you need all within this function. Maybe have a read up on ajax and json to see what stuff you can do.

D