Skip to content

Instantly share code, notes, and snippets.

@nataliepo
Created June 26, 2012 20:55
Show Gist options
  • Save nataliepo/2998898 to your computer and use it in GitHub Desktop.
Save nataliepo/2998898 to your computer and use it in GitHub Desktop.
ajax-DELETEing an object from a tornado endpoint
var api_url = $.fn.adminURL() + '/gallery/remove/' +
gallery_id + '.json';
var values = {};
$.ajax({
url: api_url,
// contentType: "application/json",
//data: JSON.stringify(values),
data: $.param(values),
dataType: "text",
type: "DELETE",
headers: {
'X-XSRFToken': $('input[name=_xsrf]').attr('value'),
},
success: function(data) {
console.log("response = ", data);
}, error: function(response) {
console.log("ERROR:", response);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment