DanWebb
12/9/2014 - 10:34 AM

Mailchimp ajax submit, From: http://stackoverflow.com/questions/8425701/ajax-mailchimp-signup-form-integration

$('#mailchimp-newsletter').submit(function(e) {
  e.preventDefault();
  var $form = $(this);
  var $resElem = $('#newsletter-response');
  
  $.ajax({
    type: $form.attr('method'),
    url: $form.attr('action'),
    data: $form.serialize(),
    cache: false,
    dataType: 'json',
    contentType: "application/json; charset=utf-8",
    error: function(err) { 
      $resElem.text('Could not connect, please try again later.'); 
    },
    success: function(data) {
      if (data.result != "success") {
        $resElem.html(data.msg);
      } else {
        $resElem.html(data.msg);
      }
    }
  });
});
<!-- Change from -->
<form action="http://xxxxx.us#.list-manage1.com/subscribe/post?u=xxxxx&id=xxxx" method="post" ... >
<!-- to -->
<form action="http://xxxxx.us#.list-manage1.com/subscribe/post-json?u=xxxxx&id=xxxx&c=?" method="get" ... >