Skip to content

Instantly share code, notes, and snippets.

View musashiXXX's full-sized avatar

Charles Hamilton musashiXXX

  • Dyer & Associates, P.C. / Community Closing Network
  • Kensington, Maryland
View GitHub Profile
@rca
rca / ajax_setup.js
Created January 29, 2012 00:27
Setup Django CSRF token in JQuery AJAX requests
/**
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off.
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request
*/
function getCookie(name)
{
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');