How to insert php code inside template literals?
Like this:
`<?php code here ?>`
But its not working
$('#cop').append(`
<table class="table table-hover">
<thead>
<tr>
<th>Student name</th>
<th>Batch name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>${element.name}</td>
<td>${element.batch_name}</td>
<td>
<a href="<?php code here?>" class="btn btn-sm btn-info"><span class="glyphicon glyphicon-edit"></span> edit profile</a>
</tr>
</tbody>
</table>
`);
You are aware that PHP and JS run at different places and different times?
1 Like
Plus, “its not working” doesn’t really help us to help you.
2 Likes
And literally sticking the words “code here” doesnt tell PHP to do anything except throw an error…
1 Like
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.