0

I'm using the z weatherfeed plugin.

It already pulls most of the data from yweather api but I need the latitude and longitude.

The plugin gets the data for each item element like this for example:

html += '<div class="weatherCountry">'+ feed.location.country +'</div>';

However, if I try this...

html += '<div class="latitude">' + feed.item.geo.lat + '</div>';
html += '<div class="longitude">' + feed.item.geo.long + '</div>';

...it doesn't get the data for these elements.

How should I go about accessing both the geo:lat and geo:long?

Here's a live example: http://jsbin.com/sibafeke/1/edit

Larz
  • 1,156
  • 1
  • 8
  • 22
  • 1
    `console.log()` the `feed.item.geo` object, and see what array items it includes. It doesn't look like it includes `lat` and `long`. – Charlie Mar 12 '14 at 20:28
  • @Charlie - It looks like it comes up as undefined. But when I log the feed.item object it actually does include lat and long values. Buuuut you just helped me figure it out. `feed.item.lat` and `feed.item.long` is what I need. Thanks! – Larz Mar 12 '14 at 20:36

1 Answers1

0

The data for geo:lat and geo:long can be accessed this way:

html += '<div class="latitude">' + feed.item.lat + '</div>';
html += '<div class="longitude">' + feed.item.long + '</div>';
Larz
  • 1,156
  • 1
  • 8
  • 22