I'm trying to add a row in a table from a data from another table. it says uncaught reference error.
here's the function
function addItem(id, name){
bootbox.confirm("Are you sure?", function(result) {
if (result) {
$('#ingredients_table').append("<tr><td>"+name+"</td></tr>");
}
});
}
here's the table where I'm calling the js function
<?php foreach($inventory as $row): ?>
<tr style="cursor: pointer;" data-toggle="tooltip" data-placement="top" title="Add ingredient" onclick="javascript:addItem(<?php echo $row->inventory_id; ?>, <?php echo $row->name; ?>)">
<td><?php echo $row->name; ?></td>
</tr>
<?php endforeach; ?>
The ID is showing in the table when I switch them, but the name is not.