AJAX/ES6 Flashcards
What is a client?
A computer or program that request services from a server
What is a server?
A computer or program (or process) that runs the service to be shared with clients
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
What three things are on the start-line of an HTTPrequestmessage?
- An HTTP method (GET, PUT, POST)
- The request target (usually a URL, everything after the domain, aka after the http://example.com/, Aks the query string)
- The HTTP version, the expected version to use for the response
What three things are on the start-line of an HTTPresponsemessage?
- The Protocol version (usually HTTP.1.1)
- The status code, indicating success or failure of the request (200 OK, 200s are successful, 404, 302 common)
- A status text, brief description of the status code
What are HTTP headers?
Additional information shared between client and servers in a response (like location or the server providing it) or request (like information of the client requesting the resource)
For example,a request message can use headers to indicate it’s preferred media formats, while a response can use header to indicate the media format of the returned body.
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?
No, it is not required. It would include data associated with the request (like content of an HTML form)
What is AJAX?
A technique used for loading data into a page without having to refresh the entire page
What does the AJAX acronym stand for?
Asynchronous JavaScript And XML(Extensible markup language)
Which object is built into the browser for making HTTP requests in JavaScript?
XMLHttpRequest object (xhr)
What event is fired byXMLHttpRequestobjects when they are finished loading the data from the server?
Load event
Bonus Question: AnXMLHttpRequestobject has anaddEventListener()method just like DOM elements. How is it possible that they both share this functionality?
They have a shared prototype object
What is a code block? What are some examples of a code block?
Any code within curly braces
If else statements, for statements, do while statements
What does block scope mean?
It will not be accessible from outside the block that its in