Created
January 2, 2018 23:33
-
-
Save Inviz/975bfd891523efdfcd09c77d3e0440dd 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
var email = '[email protected]' | |
var xhr = new XMLHttpRequest | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == 4) { | |
try { | |
var response = JSON.parse(xhr.response); | |
} catch (e) { | |
var response = { | |
status: xhr.status, | |
title: xhr.response | |
}; | |
} | |
if (response.status != 400) { | |
console.log(response) | |
} else { | |
console.error(response, response.errors, response.status, response.title) | |
} | |
} | |
} | |
xhr.open('POST', '//www.narrowdesign.com/scripts/mailchimp.php') | |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
xhr.send('email=' + email) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment