Last active
June 14, 2018 00:49
-
-
Save joeswann/a24ce711d8565a90ca65 to your computer and use it in GitHub Desktop.
Revisions
-
Joe Swann revised this gist
Jun 14, 2018 . No changes.There are no files selected for viewing
-
Joe Swann revised this gist
Jun 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ <form class="newsletter" action="https://example.us2.list-manage.com/subscribe/post-json?u=xxxxxxx&id=xxxxxxxx&c=?" method="get" > <div class="close"></div> <div class="success"> Thankyou for signing up! -
Joe Swann revised this gist
Mar 9, 2015 . 2 changed files with 16 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <form class="newsletter" action="https://companyofstrangers.us2.list-manage.com/subscribe/post-json?u=xxxxxxx&id=xxxxxxxx&c=?" method="get" > <div class="close"></div> <div class="success"> Thankyou for signing up! </div> <div class="error"> Please check your email address is correct. </div> <input name="NAME" type="text" placeholder="Full Name" /> <input name="EMAIL" type="text" placeholder="Email Address" /> <button class="btn-alt" type="submit" value="Sign Up" name="submit">Sign Up</button> </form> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ //handler for Mailchimp form handlerNewsletter: function() { var $form_wrap = $('.newsletter-wrap'); var $form = $form_wrap.find('.newsletter'); var $success = $form.find('.success'); var $error = $form.find('.error'); var action = String($form.attr('action')); -
Joe Swann revised this gist
Nov 2, 2014 . 1 changed file with 24 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,36 @@ //handler for CM form handlerNewsletter: function() { var $form_wrap = $('.newsletter-wrap'); var $form = $form_wrap.find('.newsletter'); var $success = $form.find('.success'); var $error = $form.find('.error'); var action = String($form.attr('action')); $form.submit(function(e) { e.preventDefault(); $error.hide(); $.ajax({ type: $form.attr('method'), url: action, data: $form.serialize(), cache: false, dataType: 'json', contentType: "application/json; charset=utf-8", error: function(err) { alert("Could not connect to the registration server. Please try again later."); }, success: function(data) { if (data.result != "success") { // Something went wrong, do something to notify the user. maybe alert(data.msg); $error.text('Please enter a valid email address').show(); } else { // It worked, carry on... $form.find('input').val(''); $success.show(); } } }); }); // end submit } -
Joe Swann created this gist
Nov 2, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ //Handler for Mailchimp form handlerNewsletterSubmit: function() { var $form = $('footer .newsletter form'); var $success = $form.find('.success'); var $error = $form.find('.error'); $form.submit(function(e) { e.preventDefault(); $error.hide(); $.getJSON(this.action + "?callback=?", $(this).serialize(), function(data) { if (data.Status === 400) { $error.text(data.Message).show(); } else { // 200 $form.find('input').val(''); $success.show(); js.utilRemoveLightbox(); } } ); // end getJson }); // end submit },