Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
How could i extract data that is being fetched to be displayed on html page

Im looking for a way to take the data that is being pulled from this api and perhaps add it to a variable which i can then have displayed on my html. Currently this is the api call:

fetch(`http://api.weatherstack.com/current?${params}`)
    .then(response => response.json())
    .then(data => console.log(data.current));

This is an example of what the response object would look like:

{"request":{"type":"City","query":"New York, United States of America","language":"en","unit":"m"},"location":{"name":"New York","country":"United States of America","region":"New York","lat":"40.714","lon":"-74.006","timezone_id":"America\/New_York","localtime":"2022-05-25 15:18","localtime_epoch":1653491880,"utc_offset":"-4.0"},"current":{"observation_time":"07:18 PM","temperature":20,"weather_code":116,"weather_icons":["https:\/\/assets.weatherstack.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png"],"weather_descriptions":["Partly cloudy"],"wind_speed":15,"wind_degree":170,"wind_dir":"S","pressure":1028,"precip":0,"humidity":43,"cloudcover":75,"feelslike":20,"uv_index":6,"visibility":16,"is_day":"yes"}}

I understand that i would eventually have to getElementById and set that innerHTML to the variable i store the data in, but I'm stuck in trying to store the data into a variable that i can use to display to the HTML page. Also i have an HTML page set up linking to the js file.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda