Skip to content

Instantly share code, notes, and snippets.

@brettvaida
Created November 25, 2017 20:30
Show Gist options
  • Save brettvaida/3d00bbe752f7dac036539ecfc71dc403 to your computer and use it in GitHub Desktop.
Save brettvaida/3d00bbe752f7dac036539ecfc71dc403 to your computer and use it in GitHub Desktop.
AJAX GET request boilerplate using jQuery
$.ajax({
url: 'https://api-to-call.com/endpoint',
type: 'GET',
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