- 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.codesnippet.cn/detail/2711201411070.html
来源: http://www.codesnippet.cn/detail/2711201411070.html