【发布时间】:2016-03-07 15:26:20
【问题描述】:
目前我使用@skube 方法提交mailchimp 表单。我可以成功设置并且它确实有效。但我想在我的站点中获取 mailchimp 错误消息。
喜欢:虽然有人已经订阅或提供了虚假电子邮件,或 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
【问题讨论】:
-
得到了解决方案。感谢您的努力和时间:)