Week 9 - Web Flashcards
What does AJAX stand for?
asynchronous javascript and XML
describe ajax flow control
user event create promise or handler send XMLHTTPRequest server processes request send reply html/json/text response read by handler UI updated or other action performed
what does the XMLHTTPRequest permit?
parts of a web page to be updated
without reloading the whole page
What is AJAX?
Technique allowing clients to display active content requiring communication with server • without user having to reload page • not necessarily asynchronous • not necessarily XML
What does CORS stand for?
cross-origin resource sharing
What does CORS do?
adds HTTP headers which provide browsers with a way
to request remote URLs only if they have appropriate
permissions
— if a page loaded from one web server wants to access another it must request permission from the server by performing request
What does AJAX allow?
Ajax allows client-side code to interact with server
• request sent as HTTP GET or POST
• result string extracted from server response
What are the 2 styles of asynchronous code in jS?
callbacks
promises
What is a callback?
any executable code that is passed
as an argument to other code that is expected to call back
(execute) the argument at a given time.
What is a promise?
an object that is used as a placeholder for the
eventual results of a deferred (and possibly asynchronous)
computation.
What are a promises’ 3 fields?
- object that is promised
- a function that is used to resolve/fulfil promise
- a function that is used to reject the promise
what does it mean if a promise is pending?
neither fulfilled nor rejected
What is an asynchronous function?
a function which
executes asynchronously via the event loop, using
an implicit Promise to return its result.