Created
June 20, 2018 15:13
-
-
Save cklanac/a64020a7e10fc4a459750f23fe2f2047 to your computer and use it in GitHub Desktop.
single jquery REST calls
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
// Create an Item | |
// var settings = { | |
// 'url': 'https://thinkful-list-api.herokuapp.com/chris/items', | |
// 'method': 'POST', | |
// 'data': JSON.stringify({ name: 'Milk' }), | |
// 'success': function (res) { | |
// console.log(res); | |
// }, | |
// 'error': function (err) { | |
// console.log(err); | |
// }, | |
// 'headers': { | |
// 'Content-Type': 'application/json' | |
// } | |
// }; | |
// Get a list of items | |
var settings = { | |
'url': 'https://thinkful-list-api.herokuapp.com/chris/items/', | |
'method': 'GET', | |
'success': function (res) { | |
console.log(res); | |
}, | |
'error': function (err) { | |
console.log(err); | |
} | |
}; | |
// Get a single item | |
// var settings = { | |
// 'url': 'https://thinkful-list-api.herokuapp.com/chris/items/cjin92qf3000g0k2vjn0yj19u', | |
// 'method': 'GET', | |
// 'success': function (res) { | |
// console.log(res); | |
// }, | |
// 'error': function (err) { | |
// console.log(err); | |
// } | |
// }; | |
// Update an item | |
// var settings = { | |
// 'url': 'https://thinkful-list-api.herokuapp.com/chris/items/cjin92qf3000g0k2vjn0yj19u', | |
// 'method': 'PATCH', | |
// 'data': JSON.stringify({ name: 'Orange Juice' }), | |
// 'success': function (res) { | |
// console.log(res); | |
// }, | |
// 'error': function (err) { | |
// console.log(err); | |
// }, | |
// 'headers': { | |
// 'Content-Type': 'application/json' | |
// } | |
// }; | |
// Delete an item | |
// var settings = { | |
// 'url': 'https://thinkful-list-api.herokuapp.com/chris/items/cjin92qf3000g0k2vjn0yj19u', | |
// 'method': 'DELETE', | |
// 'success': function (res) { | |
// console.log(res); | |
// }, | |
// 'error': function (err) { | |
// console.log(err); | |
// } | |
// }; | |
$.ajax(settings); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment