Created
March 15, 2016 18:57
-
-
Save rendon/dc52072ea1b79a502356 to your computer and use it in GitHub Desktop.
A quick reminder to POST using jQuery
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
$.post( | |
"http://myapi.com/v1/assets", | |
JSON.stringify({ | |
name: name, | |
email: email | |
}), | |
function(data) { | |
alert(data.message); | |
}, | |
"json" | |
).fail(function(jqXHR, textStatus, errorThrown) { | |
var data = JSON.parse(jqXHR.responseText); | |
alert(data.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment