通过AJAX mailchimp API 3.0 Bootstrap / HTML / PHP集成

时间:2015-09-14 19:50:09

标签: php html ajax mailchimp mailchimp-api-v3.0

我正在尝试使用ajax以类似的方式实现此解决方案,但我在sudo su yum groupinstall 'Development Tools' yum install -y libffi-devel libxslt-devel libxml2-devel openssl-devel python-devel mysql-devel 中得到“bool:false”

代码中是否有错误?我已经工作了几个小时,但也许我错过了一些东西。请一些帮助会很棒!

订阅表单

var_dump

自定义JS

<form action="scripts/subscribe.php" method="post" id="subscribe_form" novalidate="novalidate">
    <div class="input-group">
        <input class="form-control" type="email" name="email" id="subscribe_email" placeholder="¿Cuál es tu correo electrónico?">
        <div class="input-group-btn">
            <button type="submit" id="subscribe_submit" data-loading-text="•••"><i class="icon-envelope"></i></button>
        </div>
    </div>
</form>

Mailchimp脚本:

$('#subscribe_form').submit(function() {
    $('.error').hide();
    $('.error').fadeIn();
    // submit the form
    if($(this).valid()){
        $('#subscribe_submit').button('loading'); 
        var action = $(this).attr('action');
        $.ajax({
            url: action,
            type: 'POST',
            data: {
                newsletter_email: $('#subscribe_email').val()
            },
            success: function(data) {
                $('#subscribe_submit').button('reset');

                //Use modal popups to display messages
                $('#modalMessage .modal-title').html('<i class="icon icon-envelope-open"></i>' + data);
                $('#modalMessage').modal('show');

            },
            error: function() {
                $('#subscribe_submit').button('reset');

                //Use modal popups to display messages
                $('#modalMessage .modal-title').html('<i class="icon icon-ban"></i>Oops!<br>Something went wrong!');
                $('#modalMessage').modal('show');

            }
        });
    }
    return false; 
});

0 个答案:

没有答案