function sendNewJobFormData(form, progress) { var XHR = new XMLHttpRequest(); var FD = new FormData(form); XHR.upload.addEventListener("progress", function(event) { progress.querySelector(".determinate").style.width = ((event.loaded / event.total) * 100).toString() + "%"; }); XHR.addEventListener("loadend", function(event) { form.reset(); location.reload(); }); XHR.open("POST", window.location.href); XHR.send(FD); } function initNewJobForm(newJobFormElement) { newJobFormElement.addEventListener("submit", function(event) { event.preventDefault(); var toast = M.toast( {html: `