Skip to content

Instantly share code, notes, and snippets.

@vincentwoo
Created January 15, 2013 20:20
Show Gist options
  • Save vincentwoo/4541672 to your computer and use it in GitHub Desktop.
Save vincentwoo/4541672 to your computer and use it in GitHub Desktop.
Batch deleting templates from Sailthru
var url = "https://my.sailthru.com/template?widget=editor&action=delete&template_id="
var payload = {confirm: 1}
var ids = [...];
function del(id) {
$.post(url + id, payload, function(response) {
console.log(response)
if (response.error) {
alert(response.error);
} else if (response['redirect']) {
console.log('deleted ' + id)
del(ids.shift());
}
}, 'json');
}
del(ids.shift());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment