Wie man Ajax Call mit süßem Alarm hinzufügt
Meine Ajax-Methode sieht so aus
$.post(url,{
ajax_call:"putDonation",
addresse:addresse,
phone:phone,
email:email,
name:name,
amount:amount,
amountinwords:amountinwords
}).done(function(data){
console.log(data);
var arr = [];
try {
var str = "";
//convert to json string
arr = $.parseJSON(data); //convert to javascript array
$.each(arr,function(key,value){
str +="<li>"+value+"</li>";
});
alert(str);
$(".alert-danger").show();
$("#error").html(str);
} catch (e) {
swal("Jay Gayatri !", 'Donation Sucessful', "success")
$("#donation")[0].reset();
}
})
Ich möchte ein Popup-Fenster mit einer süßen Warnmeldung wie dieses anzeigen.
swal({
title: "Are you sure ?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
Und wenn sie auf "Abbrechen" klicken, wird der Ajax-Aufruf nicht ausgeführt. Wenn sie "Ja" auswählen, wird nur der Aufruf ausgeführt.
So kann mir jemand sagen, wie ich die Ajax-Methode in @ einbetten kaSweet Alert
methods
Vielen Dan