$('#formKehadiranKumpulan').on('submit', function(e) { e.preventDefault(); $.ajax({ url: 'kumpulan_update.php', type: 'POST', data: $(this).serialize(), dataType: 'json', success: function(response) { if (response.status) { Swal.fire({ icon: 'success', title: 'Berjaya', text: response.message }); } else { Swal.fire({ icon: 'error', title: 'Ralat', text: response.message }); } }, error: function(xhr) { console.log(xhr.responseText); Swal.fire({ icon: 'error', title: 'Ralat Server', text: 'Gagal menyimpan kehadiran kumpulan.' }); } }); });