json 및 변수 구문 분석을 사용하여 Weather Underground API를 사용하기 만합니다. 나는 문제가있다. 다른 인덱스로 코드 또는 로직을 반복하면 Json이 마지막 항목을 취합니다. 동일한 항목을 반복하지만 다른 색인이나 기간으로 반복하려고합니다. 기간은 다른 요일입니다. 어떻게하면 두 가지 응답을 얻을 수 있습니까 :날씨 지하 API 예측
일기 예보는 월요일에 약간의 구름이 때때로 있습니다. 낮음 -9C. 바람 NNW 10-15 km/h.
일기 예보 Wendesday는 수시로 구름입니다. 낮음 -9C. 바람 NNW 10-15 km/h.
$(document).ready(function($){
<!--Use your own API key and city location-->
<!--1.Embed the WU 3-day forecast summary feature.-->
$.ajax({
url: "http://api.wunderground.com/api/72df18b7f213607b/forecast/q/CO/Alamosa.json",
dataType : "jsonp",
success : function(parsed_json) {
var forecast = parsed_json['forecast']['txt_forecast']['forecastday'];
for (index in forecast) {
$(".three").html('Weather forecast for '+forecast[index]['title']+' is '+forecast[index]['fcttext_metric']);
}
다음
var forecast = parsed_json['forecast']['txt_forecast']['forecastday'];
for (index in forecast) {
$(".three").html('Weather forecast for '+forecast[2]['title']+' is '+forecast[index]['fcttext_metric']);
}
}
});
}); //Closes Doc Ready Function
이 http://www.wunderground.com/weather/api/d/docs?d=data/forecast&MR=1
this처럼 원하는 날씨 지하 문서를 수 있습니다 :
여기 내 코드입니다. .. 사람들은 그것을 사용할 수 있었다. ... –