Created
August 2, 2014 10:02
-
-
Save msmithstubbs/091478c914ef16a5e734 to your computer and use it in GitHub Desktop.
Accepts marketing checkbox with inline 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 characters
| $('#bis-submit').on('click', function(e) { | |
| e.preventDefault(); | |
| var email = $('#bis_email').val(), | |
| variant = $('.size-handle.options li.hovered').data('variant'), | |
| productId = BISPopover.product.id, | |
| options = { | |
| accepts_marketing: $('#notify_opt_in').is(':checked') | |
| }; | |
| BISPopover.create(email, variant, productId, options).then(function(response) { | |
| if (response.status == 'OK') { | |
| $('.BIS_error').hide(); | |
| $('.BIS_response').show(); | |
| $('#nbody').hide(); | |
| } else { | |
| // show error message... | |
| $('.BIS_response').hide(); | |
| $('.BIS_error').html(response.errors.email[0]).show(); | |
| } | |
| }); | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes you have a checkbox with the correct id: