HTML Forms
let form = document.querySelector('form'); form.addEventListener('submit', handleSubmit); function handleSubmit(e){ e.preventDefault(); let formData = new FormData(form); let data = Object.fromEntries(formData); let jsonData = JSON.stringify(data); fetch("https://hr.karkhana.io/api/resource/Job", { method: "POST", headers: { 'Content-Type': 'application/json' }, body:jsonData }).then(res => res.json()) .then(result => console.log(result)) .then(err => console.log(err)) }