此处将为大家介绍关于AJAXMailchimp注册表单集成的详细内容,并且为您解答有关ajax注册表单验证的相关问题,此外,我们还将为您介绍关于c#–连接到MailChimpv3.0API、css–G
此处将为大家介绍关于AJAX Mailchimp注册表单集成的详细内容,并且为您解答有关ajax注册表单验证的相关问题,此外,我们还将为您介绍关于c# – 连接到MailChimp v3.0 API、css – GMail,MailChimp在表格中添加图像间距、css – Mailchimp中的可编辑背景图像、html – Mailchimp电子邮件中的编码问题的有用信息。
本文目录一览:- AJAX Mailchimp注册表单集成(ajax注册表单验证)
- c# – 连接到MailChimp v3.0 API
- css – GMail,MailChimp在表格中添加图像间距
- css – Mailchimp中的可编辑背景图像
- html – Mailchimp电子邮件中的编码问题
AJAX Mailchimp注册表单集成(ajax注册表单验证)
是否有任何方法可以将简单的mailchimp(一个电子邮件输入)与AJAX集成在一起,所以没有页面刷新,也没有重定向到默认mailchimp页面。
谢谢
答案1
小编典典您不需要API密钥,只需将标准mailchimp生成的表单放入代码中(根据需要自定义外观),然后将表单的“
action”属性更改post?u=
为post-json?u=
,然后在表单末尾进行操作附加&c=?
以解决任何跨域问题。同样重要的是要注意,提交表单时必须使用GET而不是POST。
默认情况下,您的表单标签如下所示:
<form action="http://xxxxx.us#.list-manage1.com/subscribe/post?u=xxxxx&id=xxxx" method="post" ... >
改变它看起来像这样
<form action="http://xxxxx.us#.list-manage1.com/subscribe/post-json?u=xxxxx&id=xxxx&c=?" method="get" ... >
Mail Chimp将返回一个包含2个值的json对象:’result’-这将指示请求是否成功(我只见过2个值,“error”和“success”)和’msg’-一条消息描述结果。
我使用以下jQuery提交表单:
$(document).ready( function () { // I only have one form on the page but you can be more specific if need be. var $form = $(''form''); if ( $form.length > 0 ) { $(''form input[type="submit"]'').bind(''click'', function ( event ) { if ( event ) event.preventDefault(); // validate_input() is a validation function I wrote, you''ll have to substitute this with your own. if ( validate_input($form) ) { register($form); } }); }});function register($form) { $.ajax({ type: $form.attr(''method''), url: $form.attr(''action''), data: $form.serialize(), cache : false, dataType : ''json'', contentType: "application/json; charset=utf-8", error : function(err) { alert("Could not connect to the registration server. Please try again later."); }, success : function(data) { if (data.result != "success") { // Something went wrong, do something to notify the user. maybe alert(data.msg); } else { // It worked, carry on... } } });}
c# – 连接到MailChimp v3.0 API
我想发送一些订阅者.我究竟做错了什么?我可能正在尝试以错误的方式发送apikey(HTTP基本身份验证).文档在这里,但我无法使其工作:http://developer.mailchimp.com/documentation/mailchimp/guides/get-started-with-mailchimp-api-3/.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://us12.api.mailchimp.com/3.0/lists/<listnumber>/members/"); string json = @" { ""email_address"": ""test@test.com"",""status"": ""subscribed"",""merge_fields"": { ""FNAME"": ""Urist"",""LNAME"": ""McVankab"" } } "; byte[] data = Encoding.UTF8.GetBytes(json); request.Method = "POST"; request.Headers.Add("user","<mykeynumber>"); request.ContentType = "application/json"; request.ContentLength = data.Length; using (System.IO.Stream stream = request.GetRequestStream()) { stream.Write(data,data.Length); }
解决方法
HTTPWebRequest
.
css – GMail,MailChimp在表格中添加图像间距
表格中的图像在我的内容中留下空白后添加了空格,与此问题完全相同 – Gmail displaying gaps between images.
添加内联样式’display:block;’修复了MailChimp预览中的问题.
然而,在我在MailChimp中预览它们并在我的收件箱中接收它们之间的某个时刻,内联图像样式被删除,重新添加内联CSS再次手动修复它,这绝对是问题.
MailChimp模板中的样式
<img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner="" mc:allowtext=""https://www.jb51.cc/tag/dis/" target="_blank">display: block;">
GoogleMail阅读时的风格
<img src="IMAGE_PATH" alt="" border="0" width="700" height="665">
这有什么原因吗?是在MailChimps还是GoogleMails方面?
解决方法
一些事情要尝试:
1)删除样式声明开头的额外空格:
<img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner="" mc:allowtext=""https://www.jb51.cc/tag/dis/" target="_blank">display:block;">
2)指定!important:
(参考文献:http://www.campaignmonitor.com/blog/post/3652/gmail-strips-out-inline-css)
<img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner="" mc:allowtext=""https://www.jb51.cc/tag/dis/" target="_blank">display:block !important;">
3)尝试将line-height添加到包含的td元素:
(参考:http://www.webdevdoor.com/html-css/html-email-development-tips/)
<td> <img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner="" mc:allowtext=""https://www.jb51.cc/tag/dis/" target="_blank">display:block;"></td>
还有一个要尝试
4)添加width =“700”属性(也可能折腾高度)到img标签,只指定display:block;在style属性中:
<img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner="" mc:allowtext="" width="700" height="665"https://www.jb51.cc/tag/dis/" target="_blank">display:block;">
这是另一个
5)HTML5 doctype可能导致渲染问题.请尝试使用此代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
最后一个…
6)刚刚注意到你设置了mc:allowdesigner =“”和mc:allowtext =“”,如果从这两个中删除=“”会发生什么?
<img src="" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtexthttps://www.jb51.cc/tag/dis/" target="_blank">display:block;">
希望其中一个对您有用.
css – Mailchimp中的可编辑背景图像
有没有办法将背景标记声明为/ @ editable / region,这样我就可以更改mailchimp中的url?如果是这样,我该怎么做呢?
当前代码:
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0"https://www.jb51.cc/tag/gal/" target="_blank">gallery.mailchimp.com/78524444e0a13e2b163d98bed/images/135974c9-84e6-4f03-9fde-891a893c58a8.jpg); background-color: #24272c; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat;" background="https://gallery.mailchimp.com/78524444e0a13e2b163d98bed/images/135974c9-84e6-4f03-9fde-891a893c58a8.jpg">
我希望做什么:
/** * @tab Background Images * @section Event Image */ /*@editable*/ Var event-bg-img = "https://gallery.mailchimp.com/78524444e0a13e2b163d98bed/images/135974c9-84e6-4f03-9fde-891a893c58a8.jpg" [...] <table width="600" border="0" align="center" cellpadding="0" cellspacing="0"background="event-bg-img">
显然正在寻找一个支持跨越荒谬的电子邮件客户端的解决方案.
解决方法
/*@editable*/background-image:url();
将生成一个可编辑的字段,如下所示:
通过向背景图像添加URL,图像将显示在模板中.
例如:
url(http://placehold.it/350x150)
这将要求您将背景图像上传到MailChimp,然后抓取URL并将其粘贴到url()中,因此它并不理想.对于中级到高级用户,此解决方案可能会运行良好.
html – Mailchimp电子邮件中的编码问题
我在电子邮件中添加了一个链接:
<a href="http://www.nameofcompany.com/contact-us.PHP" target="_blank">Contact Us</a>
并且该链接显示正常,但在Gmail中点击它会将您带到该网站的404页面,即使该URL(表面上)正确.
单击该链接后,地址栏中显示的URL为http://www.nameofcompany.com/contact-us.php,这是正确的URL,在输入地址栏时直接转到正确的页面.但是,当我从电子邮件中访问此网址时,请将其从地址栏复制并粘贴到Gmail中的新电子邮件中,我看到:http://www.nameofcompany.com/contact%E2%80%90us.php
所以这似乎是字符编码的问题.我不知道如何修复它.
这是来自电子邮件HTML的doctype,charset等.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <Meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
最奇怪的是,电子邮件中的大多数URL工作得非常好,即使是那些带有破折号的URL.
是什么导致了这个问题,我该如何解决?
干杯
解决方法
今天关于AJAX Mailchimp注册表单集成和ajax注册表单验证的分享就到这里,希望大家有所收获,若想了解更多关于c# – 连接到MailChimp v3.0 API、css – GMail,MailChimp在表格中添加图像间距、css – Mailchimp中的可编辑背景图像、html – Mailchimp电子邮件中的编码问题等相关知识,可以在本站进行查询。
本文标签: