javascript - Not getting a complete conversion of Yahoo's weather API - XML to JSON -
javascript - Not getting a complete conversion of Yahoo's weather API - XML to JSON -
i'm new javascript hoping utilize json output of yahoo's weather api cool things website. problem reason i'm not getting total pull of json info , i'm not sure why. json should start @ "channel" instead starts @ "item". if follow link http://weather.yahooapis.com/forecastrss?p=usoh0293&u=c should able see finish (pre json) xml looks like.
here's javascript i'm using (it add together current status body tag)... help appreciated.
$(document).ready(function() { $.yql = function(query, callback) { var encodedquery = encodeuricomponent(query.tolowercase()), url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodedquery + '&format=json&callback=?'; $.getjson(url, callback); }; $.yql("select * rss url='http://weather.yahooapis.com/forecastrss?p=usoh0293&u=c'",function(data){ var w=data.query.results.item; var class=w.condition.text; var encodedclass = class.replace(/\s+/g, '-').tolowercase(); $('body').addclass(encodedclass); }); });
have on
http://jsfiddle.net/x3rmr/1/
javascript jquery
Comments
Post a Comment