<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="show" style="margin: 0 auto;width: 900px;">
</div>
</body>
</html>
<script src="jQuery-3.5.1.min.js"></script>
<script>
//页面加载
$(function(){
//触发ajax
$.ajax({
type:"get",
url:"http://api.k780.com/?app=weather.future&weaId=1&&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json",
dataType:"json",
success:function(res){
if(res.success == 1){
var data = res.result;
var str = "<table>";
str += "<th>城市</th>";
str += "<th>日期</th>";
str += "<th>温度</th>";
str += "<th>风向</th>";
str += "<th>操作</th>"; for(var i=0;i<data.length;i++){
str += "<tr><td>"+data[i].citynm+"</td><td>"+data[i].days+"</td><td>"+data[i].temperature+"</td><td>"+data[i].wind+"</td><td><button class='del'>删除</button></td></tr>";
}
str+="</table>"; $("#show").html(str);
$("tr:odd").css('background-color','red');
$("tr:even").css('background-color','blue');
$("tr:eq(0)").css('background-color','');
$("table").css('border','1px solid red');
}else{
console.log('接口请求失败');
}
}
});
// 删除 $("#show").on('click','.del',function(){
var res = confirm('您确定要删除吗?');
if(res){
$(this).parent().parent().remove();
} });
})
</script>

  

最新文章

  1. 大素数测试 求因子 poj 1811
  2. nginx禁止ip直接访问
  3. Maven学习总结(九)——使用Nexus搭建Maven私服
  4. 用VS2010开发Android应用的配置方法
  5. IPv6 tutorial 2 New features: Routing
  6. Codeforces #344 Div.2
  7. javascript模式——Mixin
  8. 【解决方法】System.IO.FileNotFoundException
  9. SRM 583 Div Level Two:IDNumberVerification
  10. python下载地址到迅雷qq旋风下载
  11. kafka问题集锦
  12. js模板引擎art-Template(以前的artTemplate)
  13. ef中文文档
  14. NSLog无法使用
  15. Codeforces.528D.Fuzzy Search(FFT)
  16. LuoguP2161 [SHOI2009]会场预约
  17. Oracle 12C -- 统一启动/关闭PDBs
  18. Nginx中间件使用心得(三)
  19. [转帖]CentOS基础命令大全
  20. 蓝桥杯-Anagrams问题

热门文章

  1. Redis设计与实现
  2. JVM学习四:深入分析ClassLoader
  3. android怎么做表格显示数据
  4. 【收藏】Supervisor的作用与配置
  5. Redis 学习笔记(五)高可用之主从模式
  6. 我们一起来学Shell - 正则表达式
  7. INTERSPEECH 2015 | Scalable Distributed DNN Training Using Commodity GPU Cloud Computing
  8. OpenStack、虚拟机以及和当前流行的k8s、Docker四者之间的关系
  9. 自动同步bing壁纸
  10. jdk、jre、jvm分别是什么?有什么联系?