I am programming an ASP.NET web application. I have a button with an onclick event that triggers a Javascript function with a few parameters.
When I click on the button the following error gets thrown in the browser console:
Uncaught SyntaxError: missing ) after argument list (at BusinessUnit?buLeaderId=18:212:176)
When I click on the link after "at" it marks this part of the code:
<a id="@employee.Id" class="col-2 btn btn-success"
onclick="NewAdGroupDeletionRecord(@adGroup.Name, @employee.FirstName @employee.LastName, false)">
<i class="bi bi-check"></i>
</a>
I can't seem to find anything wrong with it, especially considering that there is a closing bracket after the parameters.
Here is my code:
HTML:
<table id="DataTable" class="table table-hover">
<thead>
<tr style="text-align: left;">
<th>AD Gruppe</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var adGroup in employee.AdGroups)
{
<tr>
<th style="text-align: left;">@adGroup.Name</th>
<th>
<div class="btn-group" role="group" aria-label="Basic example">
<a id="@employee.Id" class="col-2 btn btn-success" onclick="NewAdGroupDeletionRecord(@adGroup.Name, @employee.FirstName @employee.LastName, false)">
<i class="bi bi-check"></i>
</a>
</div>
</th>
</tr>
}
</tbody>
</table>
JS:
<script>
function NewAdGroupDeletionRecord(adGroupName, employeeName, canDelete){
console.log(adGroupName);
console.log(employeeName);
console.log(canDelete);
}
</script>
Thanks in advance for anyone who takes the time to look at my question.