YQL获取天气

$(function () {
$.getJSON("http://query.yahooapis.com/v1/public/yql?callback=?", {
q: "select * from json where url='http://m.weather.com.cn/data/101210101.html'",
format: "json"
}, function (data) {
if (data.query.results) {
var result = JSON.stringify(data.query.results);
var obj = eval('(' + result + ')');
alert(obj.weatherinfo.temp1);
}
});
});

原文地址:https://www.cnblogs.com/codeloves/p/3499612.html