function sendRequest(url, data) {
const options = {
method: 'POST',
headers: {
'Content-Type' : 'application/json'
},
body: JSON.stringify(data)
}
fetch(url, options)
.then(response => {
return response.json(); // SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
})
.then(data => {
console.log(data);
})
}