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

164
Views
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
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!