Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
Assigning URL from json object forEach to embed in HTML

I've gotten to a point where I have loaded two test PDF files from my laravel controller into my blade template, and I've accessed the array of URLs via javascript successfully to the point that I can log them in the console. I hardcoded one of them into my embed in the html just to see if it works, and it does

However, I'm still stuck on figuring out how to take the value of each object index in my foreach loop (JS) and asign it to a unique variable so that I can set each PDF to just display for 60 seconds and then move on to the next, and so on

How can I fix my forEach to assign it to the embed src properly?

console logs this:

1: https:testbucket.s3.amazonaws.com/test1.pdf 
2: https:testbucket.s3.amazonaws.com/test2.pdf

Code:

@section('content')

<embed src="https:testbucket.s3.amazonaws.com/test1.pdf" style="margin-top: 100px; position:absolute; left: 0; top: 0;" width="100%" height="100%" type="application/pdf">



@endsection

@section('loadjs')

<script>

var files = '<?php echo $PDFfiles?>';
const result = JSON.parse(files);

Object.entries(result).forEach((entry) => {
const [key, value] = entry;
console.log(`${key}: ${value}`);
})

</script>

@endsection
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda