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

357
Views
Estoy tratando de usar https://jsonplaceholder.typicode.com/photos pero no se muestra soy nuevo en esto

Este es mi código que no recibe ninguna respuesta de jsonplaceholder, ¿qué debo hacer? Intenté para otros, como publicaciones/comentarios, funcionó, pero no obtengo fotos.

 function getPhotos() { fetch('https://jsonplaceholder.typicode.com/photos') .then((response) => response.json()) .then((data) => { console.log(data); let photoLayout = document.querySelector('#photo-layout'); let html = ""; data.forEach((e) => { // console.log(e) html += ` <div class="col-md-4" > <div class="card h-100 mb-3"> <img class="card-img-top" src=${e.thumbnailUrl} alt="photo"/> <div class="card-body"> <p class= "id>${e.id} <h5 class="album-title">${e.title}</h5> </div> </div> </div> `; photoLayout.innerHTML = html; }); }); } getPhotos();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe mover photoLayout.innerHTML = html; fuera del ciclo forEach.

 function getPhotos() { fetch('https://jsonplaceholder.typicode.com/photos') .then((response) => response.json()) .then((data) => { const photoLayout = document.querySelector('#photo-layout'); let html = ""; data.forEach((e) => { html += ` <div class="col-md-4" > <div class="card h-100 mb-3"> <img class="card-img-top" src=${e.thumbnailUrl} alt="photo"/> <div class="card-body"> <p class= "id>${e.id} <h5 class="album-title">${e.title}</h5> </div> </div> </div> `; }); photoLayout.innerHTML = html; }); } getPhotos();
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!