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

185
Views
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
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!