I’m trying to retrieve data from api.apixu.com. My browser asks me for permission to access my location but then noting happens.
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success);
}
else {
alert(‘Geolocation is not supported’);
}
}function success(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var Weather = “https://api.apixu.com/v1/current.json?key=4c04934e9d91459b823135519173112&q=” + lat + “,” + lng;(document).ready(function() {
.ajax({ url : Weather, dataType : "jsonp", success : function(get_json) { var location = get_json['Name']['country']; var current = get_json['temp_c']['temp_f']; var condition = get_json['text']; var img = get_json['icon']; } }); (’#location’).html(location);
('#current').html(current); (’#condition’).html(condition);
$(’#img’).attr(‘src’, img);
});
}