Created
January 15, 2013 20:20
-
-
Save vincentwoo/4541672 to your computer and use it in GitHub Desktop.
Batch deleting templates from Sailthru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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