html 使用AJAX订阅Campaign Monitor列表,并在成功时订阅真正基本的动画

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 使用AJAX订阅Campaign Monitor列表,并在成功时订阅真正基本的动画相关的知识,希望对你有一定的参考价值。

<!-- 1. Take your Campaign Monitor subscribe form as generated from within your account: -->

<form action="http://myaccount.createsend.com/t/r/s/aljhk/" method="post" id="subForm">
    <div>
        <label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" /><br />
        <label for="aljhk-aljhk">Email:</label><br /><input type="text" name="cm-aljhk-aljhk" id="aljhk-aljhk" /><br />
        <input type="submit" value="Subscribe" />
    </div>
</form>

<!-- 2. Add a success message -->

<div id="successMessage" style="display:none;">
    Thanks for signing up!
</div>
<!-- 3. And some JavaScript -->

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> 
<script type="text/javascript">
    $(function () {
        $('#subForm').submit(function (e) {
            e.preventDefault();
            $.getJSON(
                this.action + "?callback=?",
                $(this).serialize(),
                function (data) {
                    if (data.Status === 400) {
                        alert("Error: " + data.Message);
                    } else { // 200
                        // #subForm picks the element which has
                        // an id of subForm (ie our form), and
                        // then we slide it up, over 400 milliseconds.
                        $('#subForm').slideUp(400, function() {
                            // #successMessage picks out the div that
                            // contains the success message so that we
                            // can animate it 
                            $('#successMessage').slideDown();
                        });
                }
            });
        });
    });
</script>

<!-- 4. You have an AJAX subscribe form! -->

以上是关于html 使用AJAX订阅Campaign Monitor列表,并在成功时订阅真正基本的动画的主要内容,如果未能解决你的问题,请参考以下文章

Campaign Monitor表单保持重定向

html Campaign监视器ajax

html Orange FR:BK Campaign Grabber

html 新面貌:Campaign Code Cookie Grabber

html Campaign Preheader(徽标+浏览器中的视图)

Mailchimp 使用 jQuery AJAX 订阅?