Use form data constructor
This commit is contained in:
parent
550dad4c91
commit
58d173da75
|
@ -411,18 +411,14 @@
|
||||||
};
|
};
|
||||||
web.setDir = function () {
|
web.setDir = function () {
|
||||||
const dir = document.getElementById('dir').checked;
|
const dir = document.getElementById('dir').checked;
|
||||||
/*$.ajax({
|
const formData = new FormData()
|
||||||
method : 'POST',
|
console.log('set to => ' + dir)
|
||||||
url : '/dir',
|
formData.append('json', JSON.stringify({ dir : dir }))
|
||||||
data : JSON.stringify({ dir : dir}),
|
|
||||||
contentType: 'application/json',
|
|
||||||
dataType : 'json',
|
|
||||||
success : web.setDirSuccess
|
|
||||||
});*/
|
|
||||||
const opts = {
|
const opts = {
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
body : { dir : dir}
|
body : formData
|
||||||
};
|
};
|
||||||
|
console.dir(opts)
|
||||||
fetch('/dir', opts)
|
fetch('/dir', opts)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return res.json()
|
return res.json()
|
||||||
|
|
Loading…
Reference in New Issue