W5. AJAX Flashcards
1
Q
What does AJAX stand for?
A
Asynchronous Javascript And XML
2
Q
What is AJAX for?
A
Technique allowing clients to display active content requiring communication with server. - without reloading page - not necessarily asynchronous - not necessarily XML Also referred to as scripted HTML
3
Q
Process of AJAX communication between client and server
A
- Calls made to server from client for more info (may be in response to an event)
- when result of call is received from server, client updates contents of the page
(better to use asynchronous code to reduce the delay of receiving info from server)
4
Q
When is AJAX a suitable technique to use?
A
Dynamic content
- page changes without being reloaded
Client-side computation dependent on data that is:
- too large to download to client in one go
- subject to frequent change
5
Q
What is an XMLHTTPRequest Object?
A
- corner stone of AJAX
- used to exchange data between browser and server
- permits parts of web page to be updated without reloading whole page
6
Q
What properties does a Response Object have?
A
- headers: response headers
- status - status code
- statusText - HTTP status code message
- ok - boolean for status between 200-299
- response body - ArrayBuffer, Blob/file, formData etc.
7
Q
What does CORS stand for?
A
Cross-Origin Resource Sharing
8
Q
CORS key points
A
- restricted by browsers for security reasons if initiated from scripts
- XMLHTTPRequest and fetch follow same-origin policy
- web app can only request resources from same origin app was loaded from (or other sources if response contains appropriate headers)
- if a page loaded from one web server wants to access another it must request permission from server