27 lines
916 B
PHP
27 lines
916 B
PHP
@push('scripts')
|
|
<script>
|
|
$(document).ready(function() {
|
|
function addForm(tipe) {
|
|
$.ajax({
|
|
url: '{{ route('tabel.formulir.store', [$tabel->id]) }}',
|
|
type: 'POST',
|
|
data: {
|
|
tipe: tipe,
|
|
_token: '{{ csrf_token() }}',
|
|
},
|
|
success: function () {
|
|
Swal.fire({ icon: 'success', title: 'Berhasil!', showConfirmButton: false, timer: 1500 })
|
|
.then(() => window.location.reload());
|
|
},
|
|
error: function (xhr) {
|
|
Swal.fire({ icon: 'error', title: 'Gagal!', text: xhr.responseJSON?.message || 'Error' });
|
|
}
|
|
});
|
|
}
|
|
$(".add-row").click(function (e) {
|
|
e.preventDefault();
|
|
addForm('form-row');
|
|
});
|
|
});
|
|
</script>
|
|
@endpush |