Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Cannot get simple weather feteching code to work

I'm using the following code

try {
    const response = await fetch(endpoint);
    if(response.ok) {
        jsonResponse = await response.json();
        return jsonResponse;
    }
} catch(error) {
    console.log(error.message);
}

to fetch weather info from openweathermap. When I run the program locally on my computer or using a local server with VSC I get a "NetworkError when attempting to fetch resource." error caught. When I input the URL (https://api.openweathermap.org/data/2.5/weather?q=Madrid&appid=...)straight into the web browser it shows me the content without any issues. I can't for the life of me figure out what I'm doing wrong. What am I missing? (the link is missing the api key for obvious reasons, but it's written correctly in the code)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!