知识点:$.each()是对数组,json和dom结构等的遍历
var arr2=[['aaa','bbb'],['ccc','ddd'],['eee','fff']];
$.each(arr2,function(i,item){ //两个参数,第一个参数表示下标,第二个参数表示一维数组中的每一个数组
console.log(i+'````'+item);
输出的结果为:
0```````aa
1```````bb
2```````cc
3```````dd
function getweather() {
//TODO:请补充代码
var row=[];
$.get("js/weather.json",res=>{
console.log(res);
if(res.success!='1'){
alert('请求成功');
}
else{
console.log('请求成功');
$.each(res.result,(i,item)=>{
console.log(item.weather);
row.push(`
<div class="item" >
<img src="${item.weather_icon}">
<div class="item-mess">
<div>${item.weather}</div>
<div>${item.temperature}</div>
<div>${item.winp}</div>
<div>
<span>${item.days}</span>
<span>${item.week}</span>
</div>
</div>
</div>
`)
$('.week-weather').empty().append(row.join(' '))
})
}
})
}