Weather app Firefox

Hello,

I am working on Weather App and I am having problems trying to make it work in Firefox. App works in Safari.

Here is my code:

var lat;
var lon;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) { 
  lat = String(position.coords.latitude.toFixed(2));
  lon = String(position.coords.longitude.toFixed(2));
                                                             
$("#geo").html(lon);
});
}



$(document).ready(function(){

         $.ajax({
      url: "http://api.openweathermap.org/data/2.5/weather?APPID=XXXXXXXXXXXXX",
data: {lat: lat,lon: lon},
      success: function(x) {
           
                $("section").html("<strong>" + x.main.temp + "</strong>" + " " + x.weather[0].icon + " " + x.weather[0].description + x.name + " " + x.main.humidity + " " + x.wind.speed);
      }
            });
        });

And here are the errors that I get in Firefox https://gyazo.com/c03a45dc5007d16bdacf925cec627aa4

"NetworkError: 500 Internal Server Error - http://api.openweathermap.org/data/2.5/weather?APPID=XXXXXXXX"
weather…154e3e2
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://api.openweathermap.org/data/2.5/weather?APPID=XXXXXXX. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Thank you very much! Nice solution and great explanation :slight_smile:

1 Like

Hello! I want to share with you a useful link in which you get to know and learn a lot of extension & tools as well code also, actually I was facing popup message problem often mozilla firefox critical error message. then I visited this link I got all the solution to my problem. it contains very useful information, do visit it may surely help you.