
FetchIt
Lightweight component for form handling and submission using Fetch API


We cannot skip jGrowl, which was a dependency of AjaxForm. This section describes how to integrate this plugin.
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- jGrowl -->
<script src="https://cdn.jsdelivr.net/npm/jgrowl@1/jquery.jgrowl.min.js" defer></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jgrowl@1/jquery.jgrowl.min.css">FetchIt.Message as follows:document.addEventListener('DOMContentLoaded', () => {
FetchIt.Message = {
success(message) {
$.jGrowl(message, { theme: 'success' });
},
error(message) {
$.jGrowl(message, { theme: 'error' });
},
}
});defer attribute; then you do not need the DOMContentLoaded handler and have direct access to the FetchIt class:FetchIt.Message = {
success(message) {
$.jGrowl(message, { theme: 'success' });
},
error(message) {
$.jGrowl(message, { theme: 'error' });
},
}Done! We do not recommend using this library in your project if you do not already have jQuery. Adding jQuery just for one notification plugin is unnecessary and resource-heavy.