From 58d173da75a948adb5a7fd4ff9f62c73323bcf8a Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Tue, 21 Nov 2017 16:52:59 -0500 Subject: [PATCH] Use form data constructor --- app/www/index.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/www/index.html b/app/www/index.html index a6d89e0..b8b0251 100644 --- a/app/www/index.html +++ b/app/www/index.html @@ -411,18 +411,14 @@ }; web.setDir = function () { const dir = document.getElementById('dir').checked; - /*$.ajax({ - method : 'POST', - url : '/dir', - data : JSON.stringify({ dir : dir}), - contentType: 'application/json', - dataType : 'json', - success : web.setDirSuccess - });*/ + const formData = new FormData() + console.log('set to => ' + dir) + formData.append('json', JSON.stringify({ dir : dir })) const opts = { method : 'POST', - body : { dir : dir} + body : formData }; + console.dir(opts) fetch('/dir', opts) .then(res => { return res.json()