Skip to content

Instantly share code, notes, and snippets.

@vmandic
Last active February 2, 2016 12:39
Show Gist options
  • Save vmandic/05881ae3b79312deab1f to your computer and use it in GitHub Desktop.
Save vmandic/05881ae3b79312deab1f to your computer and use it in GitHub Desktop.
subscribe to mailchimp list with double opt in
function signupMailchimp() {
var d = "FIRSTNAME={0}&LASTNAME={1}&EMAIL={2}".format
(
encodeURIComponent($("#FirstName").val()),
encodeURIComponent($("#LastName").val()),
encodeURIComponent($("#Email").val())
);
if ($("form.login").valid()) {
$.ajax({
type: "GET",
url: "https://mogy.us11.list-manage.com/subscribe/post-json?u=UID&id=LISTID&c=?",
data: d,
dataType: 'json',
contentType: "application/json; charset=utf-8",
error: function (err) {
mogy.cerror("Mailchimp error.");
},
success: function (data) {
if (data.result != "success") {
mogy.cerror("Mailchimp failed.");
} else {
mogy.clog("Mailchimp passed.");
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment