2
目前我使用@skube方法提交mailchimp表单。我可以成功设置和真正的工作。但我想在我的网站中获取mailchimp错误消息。MailChimp使用Ajax获取错误响应
赞:虽然有人已经订阅或假电子邮件提供,或无效的电子邮件等mailchimp提供。
以下是@skube提供的代码。
的html代码:
<form class="myform" action="http://XXXXXXXXXlist-manage2.com/subscribe/post" method="POST">
<input type="hidden" name="u" value="XXXXXXXXXXXXXXXX">
<input type="hidden" name="id" value="XXXXXXXXX">
<input class="input" type="text" value="" name="MERGE1" placeholder="First Name" required>
<input type="submit" value="Send" name="submit" id="mc-embedded-subscribe">
</form>
Ajax代码
$('.myform').submit(function(e) {
var $this = $(this);
$.ajax({
type: "GET", // GET & url for json slightly different
url: "http://XXXXXXXX.list-manage2.com/subscribe/post-json?c=?",
data: $this.serialize(),
dataType : 'json',
contentType: "application/json; charset=utf-8",
error : function(err) { alert("Could not connect to the registration server."); },
success : function(data) {
if (data.result != "success") {
// Something went wrong, parse data.msg string and display message
} else {
// It worked, so hide form and display thank-you message.
}
}
});
return false;
});
我搜索这个,但没有发现任何有效证件。我找到了一个github代码,但是我无法使它工作。这里是github link
希望有人帮助我。
注意:我尝试使用旧的api代码方法,但mailchimp建议不要使用该方法。他们已经发布了3.0版本的API
查看此帖.. http://www.webylog.com/2015/12/02/mailchimp-integration-with-php/ –
得到了解决方案。感谢您的努力和时间:) –