I could use some help complying with Django\'s CSRF protection mechanism via my AJAX post. I\'ve followed the directions here:
http://docs.djangoproject.com/en/dev/r
As it is not stated anywhere in the current answers, the fastest solution if you are not embedding js into your template is:
Put before your reference to script.js file in your template, then add
csrfmiddlewaretoken
into your data
dictionary in your js file:
$.ajax({
type: 'POST',
url: somepathname + "do_it/",
data: {csrfmiddlewaretoken: window.CSRF_TOKEN},
success: function() {
console.log("Success!");
}
})