JS code for ajax request
It is normal, it's beacause of the CSRF token. Try this:
var csrftoken = $('[name="csrfmiddlewaretoken"]').val();
And after include this in your Ajax request
$.ajax({
...
headers: {
'Accept': 'application/json', //if json
'Content-Type': 'application/json', //if json
"X-CSRFToken": csrftoken
},
credentials: 'include',
....
})
It worked for me