JavaScript
6
Вклад в тег
var dogs = {
Fido: "Mutt", Hunter: "Doberman", Snoopie: "Beagle"
};
var myDog = "Hunter";
var myBreed = dogs[myDog];
var myBreed = myDog;
<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);
})
}