Objectives and Skills[edit | edit source]
Objectives and skills for this lesson include:
- Send and receive JSON data using AJAX
Readings[edit | edit source]
- Wikipedia: AJAX
- Wikipedia: JSON
Multimedia[edit | edit source]
- YouTube: JSON and AJAX Tutorial: With Real Examples
- YouTube: JSON Crash Course
- YouTube: Learn JSON - Full Crash Course for Beginners
Examples[edit | edit source]
Activities[edit | edit source]
- Use an online API simulation tool such as jsonplaceholder.typicode.com to test your code. Depending on configuration of your API simulation tool, the returned data may or may not match the data you send. The intent is to test XMLHttpRequest communication rather than the API itself.
Lesson Summary[edit | edit source]
Additional items will be contributed by course participants
Key Terms[edit | edit source]
- With AJAX, web applications can send and retrieve data from a server asynchronously (in the background) without interfering with the display and behavior of the existing page.
- Data Interchange Format
- A data-interchange format is a text format which is used to interchange or exchange data between different platforms and operating systems. JSON is the most popular and lightweight data-interchange format for web applications.
- GET is used to request data from a specified resource. GET is one of the most common HTTP methods (and the default method).
- It is an event handler that is called whenever the readyState attribute changes.
- POST is used to send data to a server to create/update a resource. The data sent to the server with POST is stored in the request body of the HTTP request.
- The XMLHttpRequest object is used to interact with the server (get or post data). This enables a Web page to update just part of a page without disrupting what the user is doing.
See Also[edit | edit source]
- Server-Side Scripting
- GeeksforGeeks: Difference Between JSON and AJAX
- Happy Coding: AJAX AND JSON
- MDN Cross-Origin Resource Sharing (CORS)
- Webucator how to make get post head requests using AJAX
- List of HTTP status codes
References[edit | edit source]