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