Trouble trying to automatically save checklist items which clicked
Solved by using Content-Type: application/x-www-form-urlencode with new URLSearchParams(body).toString() instead of JSON.stringify(body). autosave-checklist.js details.addEventListener(‘change’, () => { fetch(autosaveChecklist.ajaxUrl + ‘?action=autosave_checklist’, { method: ‘POST’, body: new URLSearchParams({ action : ‘autosave_checklist’, option: ‘details-checkbox’, item: details.checked }).toString(), headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, }, }) .then(res => console.log(res)) .catch(err => console.error(err));; }); socials.addEventListener(‘change’, () => { fetch(autosaveChecklist.ajaxUrl, { method: ‘POST’, body: … Read more