Newsletter Test

.breadcrumb {display: none !important;} .newsletter {margin-top: -20px !important;}
jQuery(document).ready(function($) { $(‘form.page-form’).on(‘submit’, function() { var $form = $(this); $(‘.newsletter-confirmation’).text(”).hide(); $form.find(‘input[type=submit]’).css(‘opacity’, 0.5); var authorization_header = “Bearer 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”; var list_id = ‘1308590’; var settings = { “async”: true, “crossDomain”: true, “url”: “https://api.sendgrid.com/v3/contactdb/recipients”, “method”: “POST”, “headers”: { “authorization”: authorization_header, “content-type”: “application/json” }, “processData”: false, “data”: JSON.stringify([{ email: $form.find(‘input[type=email]’).val() }]) }; $.ajax(settings).done(function(response) { var recipient_id = response.persisted_recipients[0]; var settings = { “async”: true, “crossDomain”: true, “url”: “https://api.sendgrid.com/v3/contactdb/lists/” + list_id + “/recipients/” + recipient_id, “method”: “POST”, “headers”: { “authorization”: authorization_header }, “data”: “null”, “dataType”: “text” }; $.ajax(settings).done(function(response) { displayMessage(“You’ve signed up!”); }).fail(function(jqXHR, textStatus, errorThrown) { displayMessage(‘Sorry, there was a problem.’); }); }).fail(function(jqXHR, textStatus, errorThrown) { displayMessage(‘Sorry, there was a problem.’); }); function displayMessage(str) { $form.find(‘input[type=submit]’).css(‘opacity’, 1); $form.find(‘input[type=email]’).val(”); $form.hide(); $(‘.newsletter-confirmation’).text(str).show(); } // Set this to true, if rendering inside OptinMonster return false; }); });