$(document).ready(function () { const flashdata_error = $('.flash-data1').data('flashdata'); if (flashdata_error) { swal.fire({ title: 'Perhatian!', text: flashdata_error, type: 'error' }) }; const flashdata_success = $('.flash-data2').data('flashdata'); if (flashdata_success) { swal.fire({ title: 'Data Success', text: 'Berhasil ' + flashdata_success + ' !', type: 'success' }) }; const flashdata_login = $('.flash-data3').data('flashdata'); if (flashdata_login) { swal.fire({ title: 'Login Success', text: 'Berhasil ' + flashdata_login + ' !', type: 'success' }) }; $('#show_data').on('click','.tombol-hapus',function(e){ e.preventDefault(); //Matiin dulu href dari tombol hapus const href = $(this).attr('href'); Swal.fire({ title: 'Yakin ingin menghapus data ini?', text: "Data ini akan dihapus!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Ya, Silahkan hapus.', cancelButtonText: 'Tidak.' }).then((result) => { if (result.value) { document.location.href = href; // Swal.fire( // 'Deleted!', // 'Your file has been deleted.', // 'success' // ) } }) }); $('#show_data_map').on('click', '.tombol-hapus', function (e) { e.preventDefault(); //Matiin dulu href dari tombol hapus const href = $(this).attr('href'); Swal.fire({ title: 'Yakin ingin menghapus data ini?', text: "Data ini akan dihapus!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Ya, Silahkan hapus.', cancelButtonText: 'Tidak.' }).then((result) => { if (result.value) { document.location.href = href; // Swal.fire( // 'Deleted!', // 'Your file has been deleted.', // 'success' // ) } }) }); });