Parsing History-DailySummary

  • 1
  • Question
  • Updated 3 years ago
I have been trying for hours to parse out the mean pressure field from the daily summary of a History request. If someone could help me out I would appreciate it.

The url is: http://api.wunderground.com/api/abfb6...

My code:
$.ajax({
url: "http://api.wunderground.com/api/abfb6...",
dataType: "jsonp",
success: function (parsed_json) {
var pressure = parsed_json['history']['dailysummary']['meanpressurem'];
var test = parsed_json['history']['date']['pretty']; //THIS WORKS
alert("Current temperature in " + pressure + " is: " + test);
}
});
Photo of brmcdani44

brmcdani44

  • 1 Post
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of John Wharton

John Wharton

  • 1 Post
  • 0 Reply Likes
If you modify your code to the following, I believe it will work:

$.ajax({ 
url: "http://api.wunderground.com/api/abfb6...", 
dataType: "jsonp", 
success: function (parsed_json) { 
var pressure = parsed_json['history']['dailysummary'][0]['meanpressurem']; 
var test = parsed_json['history']['date']['pretty']; //THIS WORKS 
alert("Current temperature in " + pressure + " is: " + test); 

});