$.ajax.html
发布时间:2020-12-16 02:57:26 所属栏目:百科 来源:网络整理
导读:! 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 inp
<!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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |