submit() {
$.ajax({
url: 'http://localhost:5000/data',
type: 'POST',
data: JSON.stringify({ Markers: 'heleeo' }),
contentType: "application/json",
dataType: 'json',
success: (data) => {
alert(data);
},
error: () => {
console.log('wrong');
}
});
}
when trying to access it with my node.js server it throws an error saying markers is undefined
apiRoutes.post('/data', function(req, res) {
console.log(req.body.Markers);
});