Answers for "sending json data uing fetch is empty"

0

sending json data uing fetch is empty

var myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');

fetch('/contact-form', {
    method: 'POST',
    headers: myHeaders,
    mode: 'cors',
    cache: 'default',
    body: JSON.stringify(fields)
}).then(() => {
    dispatch(contactFormSubmitSuccess());
});
Posted by: Guest on November-13-2020
0

sending json data uing fetch is empty

fetch('/api/v1/users', {  
    method: 'post',
    headers: {'Content-Type': 'application/json'},
    body: JSON.stringify({ "user": {
      "email" : email,
      "password" : password
    }}),
})
Posted by: Guest on November-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language