Created
November 25, 2017 20:43
-
-
Save brettvaida/c95ccd48de26b061e553ea606392a728 to your computer and use it in GitHub Desktop.
AJAX POST request boilerplate with 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
$.ajax({ | |
url: 'https://api-to-call.com/endpoint', | |
type: 'POST', | |
data: JSON.stringify({id: 200}), | |
dataType: 'json', | |
success(response) { | |
console.log(response); | |
}, | |
error(jqXHR, status, errorThrown) { | |
console.log(jqXHR); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment