Created
November 6, 2018 21:57
-
-
Save domtalbot/d54df38a52de31baf7b3e1e10103ae78 to your computer and use it in GitHub Desktop.
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
if (event.detail.contactFormId === '5') { | |
var formData = { | |
EMAIL: '' | |
}; | |
for (var i = 0; i < event.detail.inputs.length; i++) { | |
if (event.detail.inputs[i].name === 'your-email') { | |
formData.EMAIL = event.detail.inputs[i].value; | |
} | |
if (event.detail.inputs[i].name.substring(0,9) === 'bzo_mc_wp') { | |
var arr = event.detail.inputs[i].name.split('-'); | |
var listId = arr[1]; | |
// JS sign up to the list id. | |
jQuery.ajax({ | |
type: 'POST', | |
url: 'https://{{MC_BASE}}&id=' + listId + '&c=?', | |
data: formData, | |
cache: false, | |
dataType: 'jsonp', | |
contentType: 'application/json; charset=utf-8', | |
error: function(err) { | |
console.log(listId + '-ERROR'); | |
}, | |
success: function(data) { | |
console.log(listId + '-SUCCESS'); | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment