HTTP & AJAX Flashcards
What is a client?
A service requester.
What is a server?
A service provider.
Which HTTP method does a browser issue to a web server when you visit a URL?
The GET method
All HTTP requests and responses are composed of… (4)
- A start-line describing the requests to be implemented, or its status of success / failure.
- An optional set of HTTP headers specifying the request.
- A blank line indicating all meta-information has been sent.
- An option body containing data associated with the request or the document associated with the response.
What three things are on the start-line of an HTTP request message?
- An HTTP method, a verb (GET, PUT, POST) or a noun (HEAD, OPTIONS) that describes the action to be performed.
- The request target (often a URL) or the absolute path of the protocol port.
- The HTTP version, which defines the structure of the remaining message.
What three things are on the start-line of an HTTP response message?
- The protocol version (typically HTTP/1.1)
- A status code — indicating success or failure of the request. (200, 404, or 302 most common)
- A status text — brief purely information textual description of the status code.
What are HTTP headers?
Headers let the client and server pass additional information within an HTTP request / response
Where would you go if you wanted to learn more about a specific HTTP header?
MDN
Is a body required for a valid HTTP request or response message?
Nope!
What is AJAX?
A programming practice of building complex, dynamic webages using a techonolgy known as XMLHttpRequest
What does the AJAX acronym stand for?
Asynchronous Javascript and XML
Which object is built into the browser for making HTTP requests in JS?
XMLHttpRequest Object
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
The load event.
An XMLHttpRequest object has an addEventListener( ) method just like DOM elements. How is it possible they both share this functionality?
Via prototypical inheritance!
What does fetch( ) return?
A pwomise.