
FetchIt
Lightweight component for form handling and submission using Fetch API


Toastify JS is a lightweight library for browser notifications. This example shows how to integrate it.
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/toastify-js@1/src/toastify.min.js" defer></script>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/toastify-js@1/src/toastify.min.css">FetchIt.Message as follows:document.addEventListener('DOMContentLoaded', () => {
FetchIt.Message = {
success(message) {
Toastify({ text: message, className: 'success', gravity: 'top' }).showToast();
},
error(message) {
Toastify({ text: message, className: 'error', gravity: 'top' }).showToast();
},
}
});defer attribute; then you do not need the DOMContentLoaded handler and have direct access to the FetchIt class:FetchIt.Message = {
success(message) {
Toastify({ text: message, className: 'success', gravity: 'top' }).showToast();
},
error(message) {
Toastify({ text: message, className: 'error', gravity: 'top' }).showToast();
},
}Done! With these steps we integrate Toastify JS.