I have to first process the data (sending it to another endpoint etc.) and the continue with the normal form submission (posting it 'normal' way to form action url).
If I do 'preventDefault()' form is not submitted in a normal way. If I don't then the data is not processed, because form is submitted immediately. I tried also something like that:
$form.submit(async function (ev) {
ev.preventDefault();
const formArr = $(this).serializeArray();
const formObj = _.mapValues(_.keyBy(formArr, "name"), "value");
await doSomethingWithFormData(formObj);
return true;
});
but that doesn't work either. What can be done?