1document.addEventListener('submit', function (event) {
2 let fd = new FormData(event.target);
3})
1document.addEventListener('submit', function (event) {
2
3 event.preventDefault();
4
5 fetch('https://xxx.xxx', {
6 method: 'POST',
7 body: new FormData(event.target),
8 }).then(function (response) {
9 if (response.ok) {
10 return response.json();
11 }
12 return Promise.reject(response);
13 }).then(function (data) {
14 console.log(data);
15 })
16});
17