update form inspeksi menggunakan json
This commit is contained in:
@@ -161,7 +161,7 @@
|
||||
}
|
||||
}
|
||||
if ($analisaType === 'tanah') {
|
||||
$analisaType = 'kendaraan';
|
||||
$analisaType = 'tanah_bangunan';
|
||||
}
|
||||
|
||||
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
|
||||
@@ -227,8 +227,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script>
|
||||
@@ -320,8 +318,6 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function toggleTidakSesuai(field, inputId) {
|
||||
const selectedValue = $(`[name="${field}"]:checked, [name="${field}"]:checked`).val();
|
||||
const inputField = $(`#${inputId}`);
|
||||
@@ -347,18 +343,25 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// Pastikan respons dari server memiliki atribut 'success'
|
||||
if (response.success) {
|
||||
window.location.href = '{{ route('surveyor.index') }}';
|
||||
$('.alert').text('');
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr) {
|
||||
let errors = xhr.responseJSON.errors;
|
||||
error: function(xhr, status, error) { // Menghapus tanda kurung ganda
|
||||
let errors = xhr.responseJSON?.errors; // Pastikan xhr.responseJSON ada sebelum akses errors
|
||||
|
||||
$('.alert').text('');
|
||||
$.each(errors, function(key, value) {
|
||||
$(`#error-${key}`).text(value[0]);
|
||||
});
|
||||
if (errors) {
|
||||
$.each(errors, function(key, value) {
|
||||
$(`#error-${key}`).text(value[0]);
|
||||
});
|
||||
}
|
||||
console.error('Terjadi error:', error); // Menampilkan pesan error di konsol
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user