
FetchIt
Lightweight AJAX form submission in MODX via the Fetch API on top of FormIt or a custom snippet


Awesome Notifications: lightweight toasts in plain JS.
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/awesome-notifications@3/dist/index.var.js" defer></script>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/awesome-notifications@3/dist/style.min.css">Create an instance and set FetchIt.Message:
document.addEventListener('DOMContentLoaded', () => {
const notifier = new AWN()
FetchIt.Message = {
success(message) {
notifier.success(message)
},
error(message) {
notifier.alert(message)
},
}
})In a separate file with defer (after the FetchIt script), skip the DOMContentLoaded wrapper:
const notifier = new AWN()
FetchIt.Message = {
success(message) {
notifier.success(message)
},
error(message) {
notifier.alert(message)
},
}Form blocks [data-success] and [data-validation-error] work alongside toasts. Skip Message if you only need those blocks. Selectors: documentation.