test:天气预报接口
那么,我要如何发送ajax请求该接口呢?
$.ajax({ // type:"GET", url:"http://ali-weather.showapi.com/day15?", /* * beforeSend在提交时重新定义head头文 * 格式为 * request.setRequestHeader("Authorization", "APPCODE " + "e8444b54ae4b465781f8bee5dd8ff2cd"); * 注意appcode后有空格,不能去掉 */ beforeSend:function(request) { request.setRequestHeader("Authorization", "APPCODE " + "e8444b54ae4b465781f8bee5dd8ff2cd"); }, data:{ "area":"兰考" }, dataType:"json", success:function(data){ console.log('88'); console.log(data); } });
© 版权声明
文章版权归作者所有,未经允许请勿转载。