Is it feasible to embed and run JavaScript code in a blade template before sending an email?
The challenge lies in sending users some dynamically generated images from a third-party program requested via AJAX. The current setup is as follows:
//report.js
$(document).ready(function() {
//Fetching GPS data
$.getJSON(url + user_id, function (response) {
//...retrieve and display the images in <tbody>
});
});
@extends('template.user_theme.template')
@section('user_content')
<center>
<h3>
<b>Report</b>
</h3>
<div id="data">
<table id="images_table">
<tbody>
</tbody>
</table>
</div>
</center>
@endsection
<script src="{{ asset(".../report.js") }}" type="text/javascript"></script>
This setup is not functioning properly. The email is sent without the images, indicating the JS was never executed. Could there be another underlying issue?
Is it viable to make this work? Are there alternative approaches to consider?