RUSSEL86

mailchimp ajax activation

Jan 12th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.12 KB | None | 0 0
  1. Markup
  2. -----------
  3. <div class="subscribe-widget clearfix">
  4.     <h4>Subscribe to Our Newsletter</h4>
  5.     <!-- ===== MAILCHIMP FORM STARTS ===== -->
  6.     <form class="mailchimp inputSubscribeDiv">
  7.         <!-- SUBSCRIPTION SUCCESSFUL OR ERROR MESSAGES -->
  8.         <input type="email" name="subscribe" id="subscriber-email" placeholder="Enter your Email" class="form-control">
  9.         <button type="submit" id="subscribe-button" class="btn btn-blue ">Subscribe</button>
  10.         <h5 class="subscription-success"> </h5>
  11.         <h5 class="subscription-error"> </h5>
  12.         <label class="subscription-label" for="subscriber-email"></label>
  13.     </form>
  14.     <!-- /END MAILCHIMP FORM STARTS -->
  15. </div>
  16.  
  17.  
  18.  
  19.  
  20. jQuery activation
  21. -----------------------
  22.  
  23. (function ($) {
  24. "use strict";
  25.  
  26.  
  27.  // mailchimp start
  28.     if ($('.mailchimp').length > 0) {
  29.         /*  MAILCHIMP  */
  30.         $('.mailchimp').ajaxChimp({
  31.             language: 'es',
  32.             callback: mailchimpCallback,
  33.             url: "https://themepure.us14.list-manage.com/subscribe/post?u=5b0af3eccc324cd420b6ae5e5&amp;id=2416850e34" //Replace this with your own mailchimp post URL. Don't remove the "". Just paste the url inside "".
  34.         });
  35.     }
  36.  
  37.     function mailchimpCallback(resp) {
  38.         if (resp.result === 'success') {
  39.             $('.subscription-success').html('<i class="fa fa-check"></i><br/>' + resp.msg).fadeIn(1000);
  40.             $('.subscription-error').fadeOut(500);
  41.  
  42.         } else if (resp.result === 'error') {
  43.             $('.subscription-error').html('<i class="fa fa-times"></i><br/>' + resp.msg).fadeIn(1000);
  44.         }
  45.     }
  46.     $.ajaxChimp.translations.es = {
  47.         'submit': 'Submitting...',
  48.         0: 'We have sent you a confirmation email',
  49.         1: 'Please enter a value',
  50.         2: 'An email address must contain a single @',
  51.         3: 'The domain portion of the email address is invalid (the portion after the @: )',
  52.         4: 'The username portion of the email address is invalid (the portion before the @: )',
  53.         5: 'This email address looks fake or invalid. Please enter a real email address'
  54.     };
  55.  
  56.    
  57. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment