main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var dataSend = new FormData();
dataSend.append('a', '1');
dataSend.append('b', '2');
var request = new Request('https://httpbin.org/put', {
    method: 'PUT',
    body:      dataSend
});
console.log('request =', request);
for (var k of dataSend.keys()) {
    console.log('dataSend.get("' + k + '") =', dataSend.get(k));
}
fetch(request)
    .then(function(response) {
        return response.text();
    })
    .then(function(data) {
        console.log('data = ', data);
    })
    .catch(function(err) {
        console.error(err);
    });
Native Browser JavaScript