Skip to content

Instantly share code, notes, and snippets.

@reuf
Forked from elin3t/django ajax csfr token
Created September 30, 2015 09:37
Show Gist options
  • Save reuf/af8403940ab48baa591b to your computer and use it in GitHub Desktop.
Save reuf/af8403940ab48baa591b to your computer and use it in GitHub Desktop.
django ajax csft token
//query
$.ajax({
data: 'csrfmiddlewaretoken={{ csrf_token }}&...,
type: 'post',
});
//json
$.ajax({
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', ...},
type: 'post',
dataType: 'json',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment