Plugin thông báo Sweet alert

Gọi thông báo sweet alert


swal({title: "Error!", text: "Here's my error message!", type: "error", confirmButtonText: "Cool"});


$("#sweetbutton2").click(function(){
    swal({
        title: "Thành công!",
        text: "Hoàn thành cập nhập",
        type: "success",
        confirmButtonText: "Tắt thông báo"
    });
})

$("#sweetbutton3").click(function(){
    swal({
        title: "Bạn muốn xóa",
        text: "Xóa sẽ mất hết",
        type: "warning",
        showCancelButton: true,
        cancelButtonText: "Hủy",
        confirmButtonText: "Ok, xóa",
        closeOnConfirm: false,
    }, function () {
        swal("Deleted!", "Đã xóa thành công", "success");
    });
})

$("#sweetbutton4").click(function(){
    swal({
        title: "Tự động tắt",
        text: "Tắt trong vòng 2s",
        timer: 2000,
        showConfirmButton: false
    });
})

swal({
    title: "Ajax request example",
    text: "Submit to run ajax request",
    type: "info",
    showCancelButton: true,
    closeOnConfirm: false,
    showLoaderOnConfirm: true,
}, function () {
    setTimeout(function () {
        swal("Ajax request finished!");
    }, 2000);
});
Xem thêm về sweetalert tại đây : Link