Answers for "fetch method post handing the post add on php"

0

fetch method post handing the post add on php

// if you are going to use post method you need to send the data/body  using the formdata object
var url = '/your/url';
var formData = new FormData();
formData.append('x', 'hello');

fetch(url, { method: 'POST', body: formData })
.then(function (response) {
  return response.text();
})
.then(function (body) {
  console.log(body);
});
Posted by: Guest on October-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language