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


Notie: minimal alerts in plain JS.
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/notie@4/dist/notie.min.js" defer></script>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notie@4/dist/notie.min.css">Set FetchIt.Message:
document.addEventListener('DOMContentLoaded', () => {
FetchIt.Message = {
success(message) {
notie.alert({
type: 'success',
text: message,
})
},
error(message) {
notie.alert({
type: 'error',
text: message,
})
},
}
})In a separate file with defer (after the FetchIt script), skip the DOMContentLoaded wrapper:
FetchIt.Message = {
success(message) {
notie.alert({
type: 'success',
text: message,
})
},
error(message) {
notie.alert({
type: 'error',
text: message,
})
},
}Form blocks [data-success] and [data-validation-error] work alongside toasts. Skip Message if you only need those blocks. Selectors: documentation.