
FetchIt
Lightweight component for form handling and submission using Fetch API


SweetAlert2 is one of the most popular notification libraries and has no dependencies. To integrate it:
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- CSS is included in the script -->FetchIt.Message as follows:document.addEventListener('DOMContentLoaded', () => {
FetchIt.Message = {
success(message) {
Swal.fire({ icon: 'success', title: 'Success', text: message });
},
error(message) {
Swal.fire({ icon: 'error', title: 'Error', text: message });
},
}
});defer attribute; then you do not need the DOMContentLoaded handler and have direct access to the FetchIt class:FetchIt.Message = {
success(message) {
Swal.fire({ icon: 'success', title: 'Success', text: message });
},
error(message) {
Swal.fire({ icon: 'error', title: 'Error', text: message });
},
}Done! You now have SweetAlert2 notifications.