新人求教,api无法调用

$(document).ready(function(){
//获取IP地址
var useip="";
var temper="";
var locations="";
var wfs="";
var hums="";
var url="";
$.getJSON('http(s)://weixin.jirengu.com/weather/ip',function(useIp){
	useip=useIp[data];
	console.log(useip);
	url="http://v.juhe.cn/weather/ip?format=2&ip=222.82.39.57&dtype=json&format=&key=0e27f5e8dc09e604b74e0d80e822f56a";
	$.getJSON(url,function(weathers){
	temper=weathers["result"]["temp"];
	locations=weathers["today"]["city"];
	wfs=weathers["today"]["weather"];
	hums=weather["today"]["humidity"];
	console.log(temper);
	$(".temp").html(temper);
	$(".location").html(locations);
	$(".wf").html(wfs);
	$(".hum").html(hums);
});
});
//获取天气信息
})

无法调用天气api,报错误。不知道哪里出错了

html部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>local weather</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="G:/我的坚果云/前端编程/项目/weather/css/main.css" />
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href='http://cdn.webfont.youziku.com/webfonts/nomal/114055/47019/5a87fd24f629d909e44f6e2d.css' rel='stylesheet' type='text/css' />
    <link href='http://cdn.webfont.youziku.com/webfonts/nomal/114055/46908/5a87fc86f629d909e44f6e2c.css' rel='stylesheet' type='text/css' />
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
</head>
<body>
    <div class="header container">
        <div class="row">
            <h1 class="col-xs-12 text-center header-text">Local Weather App</h1>
        </div>
    </div>
    <div class="main container">
        <div class="row">
            <p class="temp col-xs-12 text-center"></p>
            <p class="location col-xs-12 text-center"><span class="city"></span></p>
            <p class="wf col-xs-12 text-center"></p>
            <p class="hum col-xs-12 text-center"></p>           
        </div>
    </div>
    <div class="footer container">
        <div class="row">
            <p class="col-xs-12 text-center">made by Ttang</p>
        </div>
    </div>
    <script src="js/main.js"></script>
</body>
</html>


Montgomery0
浏览 1107回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP