This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('#subscribe').submit(function() { | |
if (!valid_email_address($("#email").val())) | |
{ | |
$(".message").html('The email address you entered was invalid. Please make sure you enter a valid email address to subscribe.'); | |
} | |
else | |
{ | |
$(".message").html("<span style='color:green;'>Adding your email address...</span>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="message"></div> | |
<form role="form" method="post" id="subscribe"> | |
<input type="email" id="email" name="email" placeholder="you@yourself.com" value=""> | |
<button type="submit">SUBSCRIBE</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$api_key = "YOUR_API_KEY"; | |
$list_id = "YOUR_LIST_ID"; | |
require('Mailchimp.php'); | |
$Mailchimp = new Mailchimp( $api_key ); | |
$Mailchimp_Lists = new Mailchimp_Lists( $Mailchimp ); | |
$subscriber = $Mailchimp_Lists->subscribe( $list_id, array( 'email' => htmlentities($_POST['email']) ) ); | |
if ( ! empty( $subscriber['leid'] ) ) { |