<form name="formName" action="data" onsubmit="sendForm(event)">
<input type="text" name="input_1">
<input type="text" name="input_2">
<button type="submit">отправить</button>
</form>
function sendForm(event){
event.preventDefault;
event.stopPropagation();
let form = document.forms.formName;
let formData = new FormData(form);
formData.append = ("action","insert");
fetch(url,{
method: "POST",
body: formData
}).then(function(response){
return response.json();
}).then(function(json){
console.log(json);
})
}