SweetAlert2
SweetAlert2 replaces ugly browser alert(), confirm(), and prompt() dialogs with beautiful, customizable modals.
SweetAlert2 replaces ugly browser alert(), confirm(), and prompt() dialogs with beautiful, customizable modals.
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
// Simple alert
Swal.fire("Saved!", "Your changes have been saved.", "success");
// Confirm dialog
Swal.fire({
title: "Delete this record?",
icon: "warning",
showCancelButton: true,
confirmButtonText: "Yes, delete it"
}).then(result => {
if (result.isConfirmed) {
$.delete("/api/items/" + id);
}
});
</script>
SweetAlert2 works with async/await for clean confirm-then-action patterns.