Is there anything wrong with my JSON request? (Weather App)

Is there anything wrong with my JSON request? (Weather App)
0.0 0

#1

Can someone please tell me what is wrong with this? My console gives me this error and it’s the most aggravating feeling:

VM2499 jquery.min.js:4 GET https://s.codepen.io/boomerang/iFrameKey-6f19c899-296b-9492-c00c-a27a997426…ermap.org/data/2.5/weather?q=London&APPID=c4294c299d342c694f0c8cb6c524270b 404 ()

 var url = 'api.openweathermap.org/data/2.5/weather?q=London&APPID=c4294c299d342c694f0c8cb6c524270b';      
          
            console.log("url " + url);
          
            $.getJSON(url, function(data){
              console.log(data.weather);
            });

This is my codepen url: https://codepen.io/atalero/pen/XarREe

Thank you!


#2

Looks like your url is missing a protocol. http:// or https://

Without this, requests you make will be appended to the end of where your code is being run. You can see that your error message shows the codepen URL combined with your openweathermap url.


#3

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


#5

Yes, I realized everyone’s codepen was not working if they used the openweathermap. Thank you for your help! My project is finally making progress!