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

163
Views
Using fetch to update a webpage with data from a server

I'm creating a website in which the user can click buttons to retrieve information from the server which will then appear on the page.

Clicking on this button sends a request for the data. Looking at developer tools, I can see the request is successful however my code isn't doing anything with the response.

  let response = fetch('http://127.0.0.1:3000/dylan/list', { mode: 'no-cors' })
    .then(console.log("fetch sent"))
    //console.log(response))
    .then(response => {
      return response.text()
      console.log("response")
    }).then(text => {
       document.getElementById("folk").append(text)
       console.log("response2")})

"folk" is a list that I want the response data to be added to. For the data on the server is a json object called 'dylan'.

let dylan = ['song recommendation 1',
  'song recommendation 2',
  'song recommendation 3',
];

Any help would be appreciated.

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!