Created
September 1, 2015 23:55
-
-
Save boomtrain-support/ec0a480204d1b3f8f220 to your computer and use it in GitHub Desktop.
POST /unsubscribe - Unsubscribe a User from all Campaigns using jQuery
This file contains hidden or 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
<script> | |
// Unsubscribe a User by email address | |
function postUnsubscribe() { | |
// JSON stringify the email address | |
var json_email = JSON.stringify({ | |
email: emailAddr | |
}); | |
// Send a jQuery AJAX request to unsubscribe the email address. | |
$.ajax({ | |
url: 'https://api.boomtrain.com/unsubscribe', | |
// Replace with your Username, Password, and App Id | |
headers: { | |
'x-app-id': '{app_id}', | |
'Content-Type': 'application/json', | |
'Authorization': 'Basic ' + btoa('{username}:{password}') | |
}, | |
type: 'POST', | |
data: json_email, | |
success: function(msg) { | |
console.log(msg); | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment