Answers for "javascript get form data as json"

0

javascript get form data as json

function handleSubmit(event) {
  event.preventDefault();

  const data = new FormData(event.target);

+ const value = Object.fromEntries(data.entries());

  console.log({ value });
  }

  const form = document.querySelector('form');
  form.addEventListener('submit', handleSubmit);
Posted by: Guest on May-28-2021

Code answers related to "javascript get form data as json"

Code answers related to "Javascript"

Browse Popular Code Answers by Language