我试图在单击tag a然后单击modal show table时传递要包含在ejs中的数组
下面是我如何尝试的,但它不起作用
<a data-toggle="modal" data-target="#modalVaccination" href="#" onclick="loadModalVaccination('<%= row.id %>')">
<%= row.vaccine %>
</a>
<script type="text/javascript">
function loadModalVaccination(id) {
let data = mapItemData(rows, id);
if (data) {
vaccinationHistory= data.vaccineHistory;
}
return vaccinationHistory;
}
</script>
<%- include('../../components/reports/vaccination-modal.ejs', {
rows: vaccinationHistory
}) -%>
疫苗接种-modal.ejs
<% for (var i = 0; i < rows.length; i++) { %>
<% var row = rows[i]; %>
<tr>
<td>
<%= row.state %>
<br/>
</td>
<td>
<%= row.date%>
<br/>
</td>
<td>
<span class="checkin-icon <%= row.vaccine === 'Incomplete' ? 'no' : 'yes' %>">
<u><a data-toggle="modal" data-target="#modalVaccination" href="#">
<%= row.vaccine %>
</a></u>
</span>
</td>
<td>
<%= row.remarks%>
<br/>
</td>
</tr>
<% } %>
有什么办法帮我解决这个问题吗?
暂无答案!
目前还没有任何答案,快来回答吧!