Intro to AJAX

Welcome to this short course on AJAX requests! I hope you have as much fun taking this class as I did making it! Using AJAX requests to play with APIs is a ton of fun and opens up a huge range of services you can add to your sites :)

If you have any questions, don't hesitate to post on piazza! Happy learning!

- Cameron Pittman

The jQuery Techniques in the Class

We use jQuery in the class to run AJAX requests. The class will walk you though jQuery when you need it. The most important concept not explicitly covered is below.

Selecting an Element: Use the $(CSS_selector) syntax to select an element in the DOM. The CSS_selector can be one of tagName, .className or #id.

Vocabulary

AJAX: Asynchronous JavaScript and XML Request. A request for data from a client to a server that can occur at any time and the data received can be used to update the page without refreshing it.

API: Application Program Interface. An API provides a standardized method for the interchange of messages between machines. Many web servers offer APIs as a means to distribute information. Front-end developers can write code that will run on the client to request data from an external API.

Asynchronous: Generally, the prefix "a" means "not" "syn" means something like "same", and "chronous" means "of time". So asynchronous almost literally translates to "not at the same time." An asynchronous request doesn't need to occur at the same time as the browser's initial request for resources from a server.

GET Request: A request for information from an external machine. Browsers send GET requests to servers, which ask for the data needed to load a web page.

POST Request: A message sent to a server, which contains data the server will save in some form. For instance, when you save a change to your Facebook page, your browser sends Facebook's servers a POST request containing the data you changed.

Request: A message one machine sends to another. See GET Request and POST Request.