jQuery AJAX GET
By the end of this, developers should be able to:
- Make HTTP requests using
curl, the browser address bar, and AJAX for:
- A resource collection.
- Use response data in future requests.
Set up the client:
- Fork and clone this repository.
- Create a new branch,
training, for your work.
- Checkout to the
- Install dependencies with
We'll make requests to and receive responses from an HTTP server hosted at https://wdi-library-api.herokuapp.com
Connecting to the library-api-guide
Retrieve a list of books from the API
Demo: Browser Book Collection
https://wdi-library-api.herokuapp.com/books into the chrome address bar.
If not already installed in chrome, let's add a JSON formatting utility.
Demo: Curl Book Collection
curl is a command line utility for making http requests. We'll use curl to
retrieve the book collection.
Code Along: Curl Book Collection
Let's write that curl command into a script.
Code Along: AJAX book Collection
We'll take a stepped approach:
- Add a form to
- Add a submit input to the form.
- Add an event listener to the form in the document ready event in
- Add a submit handler to pass as callback to event listener
- Add a book collection retrieval method to
- Add a collection success and fail handler to
- Invoke the collection retrieval method from the submit handler passing the success and fail callbacks.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact email@example.com.