Jq获取新浪天气预报
调用新浪天气预报接口,获取全国各个省市区的天气预报
function GetWeather(a) { var date=new Date(); var cDate=date.getFullYear() "-" (date.getMonth() 2) "-" date.getDate(); $("#wPlace").text(a.value); $.getScript("http://php.weather.sina.com.cn/js.php?" $.param({ city: a.value, day:cDate, password: "DJOYnieT8234jlsK" }), function(json) {//数据返回 $("#weather").text(status1 " " direction1); $("#wd").text(temperature1 "°~" temperature2 "°"); /* 需要传入city参数,就是要获取天气的城市名,直接写中文名称 status1:天气状况(多云,晴,小雨,雪等等) temperature1:温度 */ });
} 在线演示:http://www.pengyaou.com/LegendsZ/Images/FileImage/weather.html
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
