JavaScript天气接口
闲话少叙上代码
function getWeather(city) {var weatherObj = {}var url = "http://wthrcdn.etouch.cn/weather_mini?city=" + city;$.ajax({async: false,type: "GET",url: url,success: function (res) {weatherObj = JSON.parse(res);},error: function (error) {console.log("获取天气数据失败请联系管理员");}});if (weatherObj.data) return weatherObj.data;else return null;}

