Get started with jquery-ajaxchimp CDN

MIT licensed

JQuery-Chimp: Lightweight plugin for MailChimps AJAX email forms in jQuery projects.

Tags:
  • mailchimp
  • ajax
  • email
  • form
  • jsonp

Stable version

Copied!

How to start using jquery-ajaxchimp CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with jquery-ajaxchimp CDN - cdnhub.io</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.cdnhub.io/jquery-ajaxchimp/1.3.0/jquery.ajaxchimp.min.js"></script>
    <script>
        $(document).ready(function() {
            $('#newsletter-form').ajaxChimp({
                url: 'https://your-api-endpoint.com/subscribe', // Your API endpoint
                callback: function(resp) {
                    if (resp.result === 'success') {
                        $('#newsletter-form').find('input[type="email"]').val('');
                        $('#newsletter-form').find('button').prop('disabled', false);
                        $('#success-message').fadeIn();
                    } else {
                        $('#error-message').fadeIn();
                    }
                },
                beforeSubmit: function() {
                    $('#newsletter-form').find('button').prop('disabled', true);
                }
            });
        });
    </script>
    <style>
        #success-message, #error-message {
            display: none;
            color: green;
        }
    </style>
</head>
<body>
    <form id="newsletter-form" method="post">
        <input type="email" name="email" required>
        <button type="submit">Subscribe</button>
        <div id="success-message">Success! You're on the list.</div>
        <div id="error-message">Error: Please check your email and try again.</div>
    </form>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions