AJAX Flashcards

1
Q

What is AJAX? why do we use it?

A

AJAX is Asynchronous JavaScript And XML. AJAX is not a programming language.It uses a combination of a browser built-in XMLHttpRequest object, to request data from a web serverJavascript and HTML DOM, to display or use the dataWe use AJAX to make aysnchronous calls to a web server. It allows the client browser to avoid waiting for all data to arrive before allowing the user to act once more

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the benefits of using AJAX?

A

AJAX improves the speed, performance and usability of a web application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain why it is important that AJAX is asynchronous

A

So that the page continues to be processed and handled replies if and when it arrives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List the steps to sending an AJAX request

A
  1. Make a XMLHttpRequest object: XMLHttpRequest request = new XMLHttpRequest()
  2. Use the object and call open method: request.open(method,url,async)
  3. Use the object and call send method: request.send() —used for get, for post use send(string) method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List the different ready states of the XmlHttpRequest object

A

Unsent (0), Opened (1), Headers_Recieved (2), Loading (3), Done (4)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does the fetch API differ from the XHR object?

A

Fetch is a new native JavaScript API. Fetch allows us to make network requests similar to XMLHttpRequest. Fetch is an improvement over the XMLHttpRequest API. The main difference between the two is that Fetch uses Promises, hence avoiding callback hell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly