sweetalert2 delete confirmation site:stackoverflow.com
<script src="<?php echo base_url(); ?>sweetalert2/dist/sweetalert2.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill"></script>
<script src="<?php echo base_url(); ?>sweetalert2/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/sweetalert2/dist/sweetalert2.min.css">
<script type="text/javascript">
function hapus() {
event.preventDefault();
var form = event.target.form;
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
})}
</script>
0
9
function hapus($___id) {
swal.fire({
title: 'Are you sure?',
text: "Are you sure you want to proceed ?",
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes'
}).then(function(result) {
if (result.value) {
$.ajax({
url : `postingan/hapus/${$___id}`,
type : 'GET',
dataType:'json',
beforeSend: function() {
swal.fire({
title: 'Please Wait..!',
text: 'Is working..',
onOpen: function() {
swal.showLoading()
}
})
},
success : function(data) {
swal.fire({
position: 'top-right',
type: 'success',
title: 'User deleted successfully',
showConfirmButton: false,
timer: 2000
});
},
complete: function() {
swal.hideLoading();
},
error: function(jqXHR, textStatus, errorThrown) {
swal.hideLoading();
swal.fire("!Opps ", "Something went wrong, try again later", "error");
}
});
}
});
}
Thank you!
9
0
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line