How to show sweet alert message?

CDN Link :- 

File Name :

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

File Name :

swal("Hello Sana!", "...I am here!");

swal("Good job!", "Thankyou Sana!", "success");

swal("Error!", "Sorry! Please Check", "error");

swal("Good job!", "Hello Sana!", "info");


File Name :

swal({

  title: "Good job!",

  text: "Hello sana!",

  icon: "success",

  button: "Ok!",

});


File Name :

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css"><br />
<!--<br />
<script src="/assets/js/sweetalert.js"></script> <br />
<script src="/assets/js/sweetalert.min.js"></script><br />
--><br />
<script src="/assets/js/sweetalert2.all.js"></script> <br />


$(document).on('click', '.deldata', function(e) {
e.preventDefault();
// var id = $(this).data('id');
var id = this.id;
/*
swal({
title: "Attention!",
text: "Are you sure you want to make this",
type: "warning",
allowEscapeKey: false,
allowOutsideClick: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "Cancel",
showCancelButton: true,
showLoaderOnConfirm: true,
// closeOnConfirm: true
})*/
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((isConfirm) => {
if (isConfirm.value) {
$.ajax({
url:"/employee/deletedata",
data:{id:id},
method:"post",
dataType:"Json",
success:function(data){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
setTimeout(function(){
location.reload(true);
},1000);
}
});
}
return false;
});




});


File Name :

$(document).on('click','.deldata_kkk',function(){
var id = $(this).data('id');
var id = this.id;
if(id!='')
{
if(confirm('Are you sure you want to delete this item?')){
$.ajax({
url:"/employee/deletedata",
data:{id:id},
method:"post",
dataType:"Json",
success:function(data){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
setTimeout(function(){
location.reload(true);
},1000);
}
});
}
}
else{
alert("Please select Id!");
}
});

File Name :

<form action="" method="POST">
<div class="">
<button class="btn btn-error" name="submit" type="submit" id="submitForm" >Submit</button>
</div>
</form>

<script>
$('#submitForm').on('click',function(e){
e.preventDefault();
var form = $(this).parents('form');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {

form.submit();
}
});
});
</script>

File Name :


$(document).on('click', '.deldata', function(e) {
e.preventDefault();

swal({
title: "Are you sure?",
text: "You want to accept this Employee!",
type: "warning",
confirmButtonText: "Yes",
confirmButtonColor: "#DD6B55",
showCancelButton: true,
closeOnConfirm: false
}).then(function(isConfirm){
if (isConfirm) {
// window.location.href = originLink;
swal({ imageUrl: "loading.gif",title:"Accepting", showConfirmButton:false, allowOutsideClick:false});

$.ajax({
url:"/employee/deletedata",
data:{id:id},
method:"post",
dataType:"Json",
success:function(data){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
setTimeout(function(){
location.reload(true);
},1000);
}
});
}
});




});





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here