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

142
Views
Tengo problemas con la API de OpenWeather + geolocalización

Esta es la primera vez que trabajo con una API. Será parte de un proyecto de práctica más grande, pero estoy un poco atascado. Primero, quiero que mi código geolocalice al usuario, obtenga la altitud y la longitud, luego use eso para hacer una llamada a la API de OpenWeather y la consola registre la temperatura, la humedad y la descripción. Mi problema parece ser que mi enlace no funciona... ¿alguien puede ayudarme a explicar qué estoy haciendo mal? (La clave Api se elimina aquí)

 /*Geolocation*/ let latUser = [] let lonUser = [] const errorCallback = (error) => {console.error(error)} const successCallback = (position) => { latUser.push(position.coords.latitude) lonUser.push(position.coords.longitude)} navigator.geolocation.getCurrentPosition(successCallback, errorCallback) /*Weather*/ let weather = { "apiKey": "xxx", fetchWeather: function () { fetch("api.openweathermap.org/data/2.5/weather?lat=" + latUser[0] + "&lon=" + lonUser[0] + "&appid=" + this.apiKey ).then((response) => response.json()) .then((data) => this.displayWeather(data)) }, displayWeather: function(data){ const { temp, humidity } = data.main const { description } = data.weather console.log (temp, humidity, description) } }
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!