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

250
Views
Crear una solicitud GET para mostrar imágenes desde un archivo JSON

Soy nuevo en Javascript y he estado escribiendo este código para mostrar una serie de imágenes en una página desde una fuente externa, algo así como un feed de Instagram, usando una solicitud GET a través de jQuery. Me dieron un archivo JSON que contiene una serie de URL de imágenes, algunas de las cuales quiero excluir porque están rotas.

Aquí está el código que he escrito hasta ahora: lo probé y no funciona y estoy buscando orientación sobre qué aspectos me pueden faltar para que mi código funcione:

 $(document).ready(function () { $('imagesFromJSON').click(function () { $.getJSON("images.json", function (data) { var arrItems = []; // The array to store JSON items. $.each(data, function (index, value) { arrItems.push(value); // Push values in the array. }); for (let i = 0; i < arrItems.length; i++) { if (arrItems[i].contains('fakeurl') === false) { let img = document.createElement('img'); img.src = arrItems[i].Image document.querySelector('.container').appendChild(image) } } }); }); });
 <html> <head> <meta charset="UTF-8"> <title>Feed Test</title> <script type='text/javascript' src='feed.js'></script> <script src="jquery-3.6.0.min.js"></script> </head> <body> <h1>FEED TEST</h1> <p><input type="button" id= "imagesFromJSON" value="Show Images" /></p> <div class="container"></div> </body> </html>

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!