$.ajax.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="img/timg.ico" />
<title>查询天气</title>
<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<input type="text" name="uesrname" id="uesrname" value="" />
<button>查询天气</button>
<h1></h1>
<!--key=ba257a360de141ce8d0f1a4a1bf2e3b-->
<script type="text/javascript">
$('button').click(function(){
var city=$('#uesrname').val()
// $.get('https://free-api.heweather.com/s6/weather/now?location='+city+"&key=091902a7ef8a4327b7d3f677af3c123f",function(res){
// console.log(res)
// $('h1').html(res.HeWeather6[0].now.tmp)
// })
//$.ajax({
// type:"get",
// url:'https://free-api.heweather.com/s6/weather/now?location='+city+'&key=091902a7ef8a4327b7d3f677af3c123f',
// async:true,
// complete:function(res){
// console.log(res.responseJSON)
// }
// });
//}) $.ajax({
type:"get",
url:"https://free-api.heweather.com/s6/weather/now?location="+city+"&key=091902a7ef8a4327b7d3f677af3c123f",
async:true,
complete:function(res){
console.log(res)
}
});
})
</script>
</body>
</html>
随机推荐
- java项目打包
http://blog.csdn.net/qq_34845382/article/details/53885907 自己用Rinnable JAR file 方法也可以.更简单.直接点击Finish即 ...
- 【django】分页
分页 1.简单分页 from django.conf.urls import url from django.contrib import admin from app01 import views ...
- linux centos安装zabbix 4.0服务端
1.服务器安装docker sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manag ...
- Hadoop点滴-初识MapReduce(2)
术语: job(作业):客户端需要执行的一个工作单元,包括输入数据.MP程序.配置信息 Hadoop将job分成若干task(任务)来执行,其中包括两类任务:map任务.reduce任务.这些任务在集 ...
- 如何把安全证书导入到java中的cacerts证书库
每一步:进入某个https://www.xxx.com开头的网站,把要导入的证书下载, 在该网页上右键 >> 属性 >> 点击"证书" >> 再 ...
- Andorid监听SoftKeyboard弹起事件
对于Android键盘事件Google并没有提供一个好的接口去监听它,有时候就为项目需要就必须要自己去想办法去监听,由于我最近也要实现登陆与注册的功能,我的想法很简单实现起来也比较容易,主要的原理是在 ...
- H5刮刮卡效果
效果图: 核心就是使用ctx.globalCompositeOperation = 'destination-out'; 全部代码: <!DOCTYPE html> <html> ...
- HDU 2044——一只小蜜蜂...(DP)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2044 题解 //递归思想,超时 #include<iostream> using namesp ...
- Newtonsoft.Json.Linq 常用方法总结
目录 1.Entity to Json 1.1.准备工作 1.2.Entity to Json 1.3.Json to Entity 2.Linq To Json 2.1.创建对象 2.2.从 Jso ...
- 【NOIP2011】选择客栈
题文: 丽江河边有n 家很有特色的客栈,客栈按照其位置顺序从1 到n 编号.每家客栈都按照某一种色调进行装饰(总共k 种,用整数0 ~ k-1 表示),且每家客栈都设有一家咖啡店,每家咖啡店均有各自的 ...