如何将Mailchimp与Ionic应用程序集成?

时间:2017-01-18 02:52:28

标签: android ios angularjs ionic-framework

我正在创建一个Ionic应用程序,我正在尝试整合mailchimp。我正在使用嵌入式表单,只要我在浏览器上运行它(离子服务器),它们就可以工作,但每当我在本机设备上测试它都不起作用。有人知道怎么做这个吗?感谢。

<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
    #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
    /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
       We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>


<!--<label class="item item-input">
  <span class="input-label">Email</span>
  <input type="email">
</label>-->
<div id="mc_embed_signup">
<form action="//[businessname].[dc].list-manage.com/subscribe/post?u=[list]&amp;id=39c3c32163" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
    <div id="mc_embed_signup_scroll">
    <h3 class="padding">Don’t Miss Out on the Top Stories from Each Week!</h3>
<div class="mc-field-group">
    <label for="mce-EMAIL" class="item item-input">
    <span class="input-label">Email Address: </span>
    <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
  </label>
</div>
<div class="mc-field-group" >
    <label for="mce-FNAME" class="item item-input">
    <span class="input-label">First Name: </span>
    <input type="text" value="" name="FNAME" class="" id="mce-FNAME">
  </label>
</div>
<div class="mc-field-group" >
    <label for="mce-LNAME" class="item item-input">
    <span class="input-label">Last Name: </span>
    <input type="text" value="" name="LNAME" class="" id="mce-LNAME">
  </label>
</div>
<div class="mc-field-group" >
    <label for="mce-MMERGE9" class="item item-input">
    <span class="input-label">State: </span>
    <input type="text" value="" name="MMERGE9" class="" id="mce-MMERGE9">
  </label>
</div>
    <div id="mce-responses" class="clear">
        <div class="response" id="mce-error-response" style="display:none"></div>
        <div class="response" id="mce-success-response" style="display:none"></div>
    </div>    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
    <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_1b57193ff878b1601ed47f497_39c3c32163" tabindex="-1" value=""></div>
    <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button button-positive button-block"></div>
    </div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[9]='MMERGE9';ftypes[9]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->

1 个答案:

答案 0 :(得分:0)

您需要更改两行。将#form添加到表单标签,然后(click)=“ form.submit()”输入标签:

 private static String fileName = "C:\\fruit.csv"; 
public static void main(String[] args) throws 
IOException{
 BufferedReader br = new BufferedReader(new 
FileReader(fileName));
 TreeMap<String,Integer> tm = new 
TreeMap<String,Integer>();
    String line;
    Logger logger = Logger.getLogger("Sample");
    BasicConfigurator.configure();
    logger.setLevel(Level.DEBUG);
    try{
        while((line = br.readLine()) != null){
            String[] words = line.split("\\s");
            for(String s : words){
                if(!tm.containsKey(s)){
                    tm.put(s,1);
                    logger.debug(s+""+tm.get(s)+"N");}else{
                    tm.put(s,tm.get(s).intValue()+1);
                    logger.debug(s+""+tm.get(s)+"N");}}}
        }catch(IOException e){
        logger.debug("Error");
        }finally{ br.close()}
        Writer fw = new FileWriter("C:\\count.properties");
        Properties p =new Properties();
        for(String key : tm.keySet()){
            p.setProperty(key,String.valueOf(tm.get(key)));
        }p.store(fw,"fruit");}}}