Created
February 16, 2015 22:21
-
-
Save nlf/25c59354e1575a561f33 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 request = new XMLHttpRequest(); | |
request.onload = function () { | |
// request.status is the HTTP status code of the response | |
// request.responseText is whatever data the server sent back | |
// easiest for this would be something like | |
if (response.status === 200) { | |
// form posted ok | |
} else { | |
// form failed to post | |
} | |
}; | |
request.open('POST', '/submit', true); | |
request.setRequestHeader("Content-Type", "application/json"); | |
request.send(formData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment