天气接口

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:温度 
        */
    });  
}




你可能感兴趣的:(天气接口)