Skip to content

Instantly share code, notes, and snippets.

@nhalstead
Created August 7, 2020 18:12
Show Gist options
  • Save nhalstead/169bbcc5e7e2d00e4e85b43700119dd6 to your computer and use it in GitHub Desktop.
Save nhalstead/169bbcc5e7e2d00e4e85b43700119dd6 to your computer and use it in GitHub Desktop.
app.salesloft.com Unsubscribe
var params = location.search
.substr(1)
.split("&")
.reduce(function(params, param) {
params[param.split('=')[0]] = decodeURIComponent(param.split('=')[1])
return params
}, {})
document.getElementById('email').textContent = params['email']
document.getElementById('form').addEventListener('submit', function(event) {
event.preventDefault()
var request = new XMLHttpRequest()
request.open('POST', params['confirm_opt_out_path'], true)
request.onload = function() {
document.getElementById('start').classList.add('hidden')
document.getElementById('done').classList.remove('hidden')
}
request.send()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment