-1
FCCで天気アプリを作成していますが、コードが機能しないため停止しています。私は私の場所へのブラウザアクセスのためのポップアップリクエストを取得していません。 私はbutton.click
機能でそのポップアップ要求をラップしました。 私は初心者であり、非常に不満を感じています。私は助けが必要です!!お使いのブラウザで
var Api= "https://fcc-weather-api.glitch.me/api/current?";
$(document).ready(function(){
$("button").click(function(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var lat = "lat=" + position.coords.latitude ;
var lon = "lon=" + position.coords.longitude;
$.get(Api+lat+"&"+ lon, function(result){
$("#city").text(result.main.name);
$("#country").text(result.sys.country);
$("#weather").text(result.weather[0].main);
$("#w-icon").text(result.weather[0].icon);
$("#temp").text(result.main.temp);
$("humidity").text(result.main.humidity);
});
});
});
else {
console.log ("Geolocation is not supported by this browser");
}
});
https://codepen.io/Ojomiba/pen/dVgQeQ
なぜ投票が遅いのですか?私は、サイトを使って学習しようとしているときに、さらなる質問をすることを禁止されます。 – user8953638