Jquery学习总结(3)——Jquery获取当前城市的天气信
来源:互联网 发布:webservice soap java 编辑:程序博客网 时间:2024/06/06 07:02
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();
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();
0 0
- Jquery学习总结(3)——Jquery获取当前城市的天气信
- jQuery获取新浪城市与天气信息
- Unity获取当前城市天气
- ajax获取当前城市天气情况
- [一天一项目]获取当前天气——获取某个地区当前的天气情况。
- 获取指定城市的天气
- js定位当前城市,获得当前城市的天气
- jquery获取当前的节点
- 通过城市的citycode获取天气数据(逻辑)
- 基于百度定位获取当前城市请求天气信息
- Jquery的城市联动
- flex webservice获取城市的天气情况
- Android 获取指定城市的天气实况
- Jquery学习总结(5)——jQuery选择器
- js获取当前城市,并根据当前城市获得当地天气
- Python获取当地的天气和任意城市的天气
- jquery获取当前时间
- jquery获取当前时间
- 使用Intent传递自定义对象
- 安卓开发起始页面+引导页+进入主程序
- 分库后的分页处理
- Android开发03_Intent跳转
- Android 高仿微信语音聊天页面高斯模糊效果
- Jquery学习总结(3)——Jquery获取当前城市的天气信
- 08.05
- 无线路由器提供AP、Client、Router、Bridge、Repeater五种工作模式各自含义
- 使用angularjs的键盘事件来增强用户体验
- 2016.8.4 开营测试总结
- CentOS中搭建NodeJS环境
- volatile和synchronized的区别和联系
- 内部的XSS攻击的防范
- memcahce添加服务器,实现集群