1

Trying to setup a html input form to send data to app script doPost, fetch receive a response without error, but app script doesn't appear to receive any data and no log.

js

const url = 'https://script.google.com/macros/s/***/exec';

fetch(url, {
    method: 'post',
    mode: 'no-cors',
    followAllRedirects: true,
    body: JSON.stringify(data),
    headers: {
      'content-type': 'application/json',
    },
  })
  .then(response => {
    console.log(data);
    alert('Thank you ok desu');
    
  }).catch(error => console.log(`something wrong with post ${error.message}`))

App script: deployed as webapp, execute as me, access by anyone

function doPost(e) {
  Logger.log('posted');
  console.log('posted c');
  var msg= JSON.parse(e.postData.contents);  
  console.log(msg);
  return ContentService.createTextOutput('...');
}
Pidan
  • 21
  • 3

0 Answers0