I'm trying to send POST with some variables to Django.
Send from JS:
function sendStatistic(csrftoken, song_id, answer) {
fetch('request/', {
method: 'POST',
headers: {
'X-CSRFToken': csrftoken,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: {
'Song-Id': song_id,
'Answer': answer
,},
});
}
And try to capture 'Song-Id' and 'Answer' in Django but:
request.POST.get('Answer')
returns None
what am I doing wrong?