Django Fetch API JSON Parse Unexpected Character

I'm trying to update an upvote downvote counter with fetch api on my Django App about poop.

I'm new to fetch and using this project to learn about it.

It is returning the JsonResponse, but it kicks out an Error which I'm not sure how to troubleshoot.

I've Followed the Basic Structure of the Fetch Tutorials, but I'm getting this strange error. I don't see what's wrong with my syntax, please help!

.html this is the div counter I'm trying to replace

<div class="voteCount{{poopfact.id}}">{{ poopfact.total_votes }}</div>

.script here's my basic javascript, kicking out the error

fetch(url, {
            headers:{
              method: 'POST',
              'Accept': 'application/json',
              'X-Requested-With': 'XMLHttpRequest', 
              'poopfact_id':poopfact_id
          }
          })
          .then(response => response.json())
          .then(data => console.log(data))
          .catch(error => console.log('error'))

.views this is what I'm returning, it seems successful

def vote(request, poopfact_id):
   ...
   data = {
            "total_votes": total_votes,
            "value":poopfact_id
          }
          return JsonResponse(data, safe=False)

console.log error I'm not sure how to troubleshoot it. Can anybody point me in the right direction? enter image description here

Back to Top