cómo obtener la identificación del bucle en el botón
mi navegador muestra un mensaje como este, porque estoy recortando el botón con la función onclick(). ¿hay alguna otra solución?
Error al manejar la respuesta: TypeError: self.processResponse no es una función en la extensión de cromo://cmkdbmfndkfgebldhnkbfhlneefdaaip/js/notification.js:154:10
mi código html con algunos bucles de blade de laravel
<div class="table-responsive" id="gender">
<table class="table" id="genders-table">
<thead>
<tr>
<th>Jenis Kelamin</th>
<th>Is Active</th>
<th colspan="3">Action</th>
</tr>
</thead>
<tbody>
@foreach($genders as $gender)
<tr>
<td>{{ $gender->jenis_kelamin }}</td>
<td>{{ $gender->is_active }}</td>
<td width="120">
<div class='btn-group'>
<a href="{{ route('genders.show', [$gender->id]) }}" class='btn btn-default btn-xs'>
<i class="far fa-eye"></i>
</a>
<a href="{{ route('genders.edit', [$gender->id]) }}" class='btn btn-default btn-xs'>
<i class="far fa-edit"></i>
</a>
<button class='hapus btn btn-danger btn-xs' id='hapus' onclick="hapus(<?= $gender->id ?>)"><i class='far fa-trash-alt'></i></button>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
mi código js. obtenga la identificación del corte y haga una llamada ajax
function hapus(genderId) {
bootbox.confirm("Do you really want to delete record?", function(result) {
if (result) {
$.ajax({
url: '{{ url("api/genders/") }}' + '/' + genderId,
dataType: "JSON",
type: "DELETE",
data: genderId,
success: function(data, textStatus, xhr, response) {
// alert(true === 1);
if (data.success == true) {
$('#gender').load(" #genders-table", function() {
alert("data berhasil di hapus")
})
} else {
bootbox.alert('Record not deleted.');
}
}
})
}
})
}
Mostrar la mejor respuesta