An important reminder to include following header while sending data in Javascript fetch() call in JSON format.
Also, do not forget to use JSON.Stringify().
var data = { some_data: ABC};
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify( data ),
This is not needed if you are creating a form data object and appending data to it.
var data = new FormData();
data.append( 'some_data', 'ABC' );
Category: Javascript