
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 use it:
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2-neutral/dist/sweetalert2.all.min.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2-neutral/dist/sweetalert2.min.css">FetchIt.Message property as follows:document.addEventListener('DOMContentLoaded', () => {
FetchIt.Message = {
success(message) {
Swal.fire({
icon: 'success',
title: message,
showConfirmButton: false,
});
},
error(message) {
Swal.fire({
icon: 'error',
title: message,
showConfirmButton: false,
});
},
}
});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: message,
showConfirmButton: false,
});
},
error(message) {
Swal.fire({
icon: 'error',
title: message,
showConfirmButton: false,
});
},
}You will now see SweetAlert2 notifications.