【发布时间】:2018-07-09 11:37:37
【问题描述】:
是否可以在刀片模板中包含和执行(在发送电子邮件之前)javascript 代码?
问题是我需要通过电子邮件向用户发送一些图像,这些图像是由 3rd 方程序动态生成的。我通过 AJAX 请求得到了它们。所以我现在所拥有的是这样的:
//report.js
$(document).ready(function() {
//Retrieving the GPS data
$.getJSON(url + user_id, function (response) {
//...get and shows the images on <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>
但这不起作用。 电子邮件到达用户时没有图像,这意味着 JS 从未执行过?还是有其他问题?
有可能实现这样的目标吗? 还有其他方法吗?
【问题讨论】:
-
不,这不可能。您必须使用后端获取图像并将它们直接包含在模板中。
标签: javascript ajax laravel laravel-5.4