<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery跨域调用REST天气预报API</title>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<div id="main" style="margin-top:10px; width:690px; padding:1px; margin:0 auto; text-align:left;">
<div>
<p style="font-family:verdana; font-size:20px; color:green;">
<span >使用REST获取World Weather Online上深圳的天气</span>
</p>
</div>
<div style="margin-top:20px;">
<span id="weather_text">正在获取深圳的天气情况,请稍等……</span>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
jQuery.getJSON("http://api.worldweatheronline.com/free/v1/weather.ashx?q=Shenzhen&format=JSON&num_of_days=5&key=689ab058717194e693b1fc1012fdb857d6874547&callback=?",
function(data) {
var value="";
//解析数组
$.each(data.data.weather, function(i, item) {
value += "日期:"+item.date+" 天气:"+item.weatherDesc[0].value+" 最低温度:"+item.tempMinC+" 最高温度:"+item.tempMaxC+"<br />";
});
$("#weather_text").html(value);
});
});
</script>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
REST_Test.rar (13个子文件)
jQuery
get_weather.html 1KB
js
jquery.js 92KB
C#
RESTTest
RESTTest
Form1.cs 3KB
Program.cs 467B
RESTTest.csproj 3KB
Form1.resx 6KB
Properties
Settings.settings 249B
Resources.Designer.cs 3KB
AssemblyInfo.cs 1KB
Settings.Designer.cs 1KB
Resources.resx 5KB
Form1.Designer.cs 3KB
RESTTest.sln 913B
共 13 条
- 1
genfeng
- 粉丝: 5
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页