您当前的位置: 首页 >  jquery

科技D人生

暂无认证

  • 0浏览

    0关注

    1550博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Jquery学习总结(3)——Jquery获取当前城市的天气信

科技D人生 发布时间:2016-08-05 09:18:25 ,浏览量:0

Jquery代码: function findWeather() {     var cityUrl = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js';     $.getScript(cityUrl, function(script, textStatus, jqXHR) {         var citytq = remote_ip_info.city ;// 获取城市         var url = "http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&city=" + citytq + "&day=0&dfc=3";         $.ajax({             url : url,             dataType : "script",             scriptCharset : "gbk",             success : function(data) {                 var _w = window.SWther.w[citytq][0];                 var _f= _w.f1+"_0.png";                 if(new Date().getHours() > 17){                      _f= _w.f2+"_1.png";                                 }                 var img = "";                 var tq = citytq + " " + img + " " + _w.s1 + " " + _w.t1 + "℃~" + _w.t2 + "℃  " + _w.d1 + _w.p1 + "级";                 $('#weather').html(tq);             }         });     }); } findWeather();
关注
打赏
1662604032
查看更多评论
立即登录/注册

微信扫码登录

0.0435s