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

你可能感兴趣的:(JavaScript,jquery)