Created
February 21, 2018 11:37
-
-
Save SilencerWeb/c80c8b34fb829c4a5202bd64928bd067 to your computer and use it in GitHub Desktop.
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
function b64EncodeUnicode(str) { | |
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, | |
function toSolidBytes(match, p1) { | |
return String.fromCharCode('0x' + p1); | |
})); | |
} | |
fetch('https://us17.api.mailchimp.com/3.0/lists/185415c92c/members', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': `Basic ${b64EncodeUnicode('silencerweb:8ec49e64f2041073d3fe56e0abc5fe5f-us17')}`, | |
}, | |
body: JSON.stringify({ | |
email_address: 'email@mail.ru', | |
status: 'subscribed', | |
}), | |
mode: 'no-cors', | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment