我正在尝试测试 api 调用是否成功,但是当我在函数中调用 console.log() 命令时,控制台中没有打印任何内容。请帮忙。
$.getJSON('http://freegeoip.net/json/').done(function(location){
console.log(location.city);}
和 ...
$.getJSON('http://api.openweathermap.org/data/2.5/weather?lat='+latitude+'&lon='+longitude+'&unit=imperial&appid=5b98cbb01e7b431b5f074efdd59bb78b', function(data){
apiData = data;
console.log(apiData);}
此外,当我尝试使用“$('#element').html(variable)”用 jquery 覆盖元素中的 html 时,刷新实际页面时没有任何注册。任何帮助将不胜感激。