Try to parse the response body text as JSON (response.json()) and got this error in the console:
Uncaught (in promise) SyntaxError: Unexpected end of input (at script.js:177:33)at postData (script.js:177:33)
This is the code that throw the error in the line of .then(response => response.json()).
fetch('/', {
    method: 'POST', // or 'PUT'
    mode: 'no-cors',
    headers: {
      'Content-Type': 'application/json',
    },
    redirect: 'follow',
    referrerPolicy: 'origin-when-cross-origin',
    body: JSON.stringify({
      "email": emails.val()
    }),
  })
  .then((response) => response.json())
  .then((data) => {
    console.log('Success:', data);
  })
  .catch((error) => {
    console.error('Error:', error);
  });
I expect it to post data (emails.val()) to the body of the endpoint so I can use the controller I wrote to take the data from this endpoint and insert it to model.
 
    