Created
November 11, 2020 10:50
-
-
Save yazinsai/cc6cc2119b4420c86edd15e1f1b1b611 to your computer and use it in GitHub Desktop.
A simple script to register a user to ConvertKit using only Javascript
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
/* Submit an email address to ConvertKit using only Javascript */ | |
function submitForm(email) { | |
fetch('https://app.convertkit.com/forms/XXXXXX/subscriptions', { | |
// replace XXXXXX above with your form ID (e.g. 1231234) | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}, | |
body: `email_address=${email}` | |
}).then((response) => { | |
// TODO: Show a message that the subscription was successful! | |
}); | |
} | |
// That's it! | |
// Use like so: submitForm("[email protected]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment