Chapter 8: Ajax Flashcards

1
Q

What is AJAX?

A

A technique for loading data into part of a page without having to refresh the entire page

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

What is JSON?

A

Javascript Object Notation (Not javascript but string of javascript code)

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

What’s the common syntax for sending an XML Http Request?

xmlhttprequest
XMLHttpRequest
xmlHttpRequest

A

XMLHttpRequest

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

How to make an AJAX request

A

-create a new XMLHttpRequest.Then use the open and send methods. The open method takes 3 parameters: HTTP method, URL for page that handles request, Boolean to indicate if it should be asynchronous

var xhr = new XMLHttpRequest();

xhr. open(‘GET’, data/test.json, true);
xhr. send(‘search=arduino’);

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

What happens once the Browser has received and loaded data from the server

A

The online event will fire. The requests status will be checked and determine what side will run.

xhr.onload = function() {
  if (xhr.status === 200) {
    //do some code
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What Data Formats can the serve send back?

A

HTML
XML
JSON

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