<button onclick="getWeather"> 获取天气信息</button>
<p id="weather"></p>
//获取天气情况
functionweather() {
$.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js',function(_result) {
if(remote_ip_info.ret =='1') {
$.ajax({
type:"GET",
url:"http://wthrcdn.etouch.cn/weather_mini",
data: {"city":"北京"},
success:function(data){
var_data =JSON.parse(data);
vartype = _data.data.forecast[0].type;
varhigh = _data.data.forecast[0].high;
varlow = _data.data.forecast[0].low;
high = high.split(" ");
high = high[1];
low = low.split(" ");
low = low[1];
varweather = type +" "+ low +"~"+ high;
$("#weather").html(weather);
}
});
}
});
}..
网友评论