Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Send Form Data Using Fetch

async function sendFormData()
 {

 const myData = document.getElementById("myData");
const formData = new FormData(myData);

	const obj= Object.fromEntries(formData);

const res = await fetch('/test', {method:'POST', body: JSON.stringify(obj), headers:{'Content-type': 'application/json; charset=UTF-8'}});
const response = await res.json();

console.log(response["a"]);

 }
Source by ashabbsoftmart.web.app #
 
PREVIOUS NEXT
Tagged: #Send #Form #Data #Using #Fetch
ADD COMMENT
Topic
Name
6+3 =