【发布时间】:2015-12-25 03:43:24
【问题描述】:
我的 html 文件中有一个类名为 today 的 div 元素,我正在尝试在其上打印温度,为此我编写了以下代码,但这没有在 div 元素上打印任何内容,请帮助。
$http.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22islamabad%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
.success(function (response) {
var result = response.query;
var temp=result.results.channel.item.condition.temp;
var text=result.results.channel.item.condition.text;
var weather = $scope.weather = temp+" "+text;
document.getElementsByClassName("today").innerHTML = weather;
});
【问题讨论】: