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

171
Views
Getting Data from the Frontend & CORS

i´m stuck at a little demo project from udemy with django and api calls. I have this in main.js and I want to get array of object and not just a json list in console.

let projectsUrl = 'http://127.0.0.1:8000/api/projects/'

let getProjects = () => {
   
    fetch(projectsUrl)
        .then(response => response.json())
        .then(data => {
            console.log(data)
            buildProjects(data)
        })
   
}

let buildProjects = (projects) => {
    
    let projectsWrapper = document.getElementById('testz')

    for (let i = 0; projects.lenght > i; i++){
        let project = projects[i]
        console.log(project)
    }
}


getProjects()

The result :

Console Log

and the result should be something like this :

Console Log

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is a typo.

change

projects.lenght

to

projects.length
about 4 years ago · Juan Pablo Isaza Report
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!