Skip to content

Instantly share code, notes, and snippets.

@lorenmh
Created December 24, 2014 00:44
Show Gist options
  • Save lorenmh/17c91d8f63230353ba24 to your computer and use it in GitHub Desktop.
Save lorenmh/17c91d8f63230353ba24 to your computer and use it in GitHub Desktop.
$.ajax('/api/u/', {
type: 'POST',
data: JSON.stringify({}),
headers: {
'X-XSRF-TOKEN': (function() {
var i = document.cookie.indexOf('XSRF-TOKEN') + 11;
return document.cookie.substring( i , i + 32 )
})()
}})
.success(function(r) {
console.log(r);
})
.fail(function(r) {
console.log(r.responseText);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment