Skip to content

Instantly share code, notes, and snippets.

@gerhc
Created August 9, 2012 13:46
Show Gist options
  • Save gerhc/3304309 to your computer and use it in GitHub Desktop.
Save gerhc/3304309 to your computer and use it in GitHub Desktop.
AJAX POST
xhr = new XMLHttpRequest();
xhr.open("POST", "add_specs/", false);
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
data = JSON.stringify(spec_rows);
xhr.send(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment