AJAX Flashcards

1
Q

What does AJAX stand for?

A

Asynchronous
Javascript
And
XML

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

What is AJAX used for?

A

Using Javascript on server after webpage has loaded to get more information in the form of XML (or JSON)

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

What is XML used for?

A
Store data
Transfer data
Terminology
it's a data format that sits there
contract
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What problems exist with cross domain policies in browsers? What’s a solution?

A

You are not allowed to make AJAX requests to a webpage perceived to be on a different server by the browser
JSONP is a solution

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

What does JSON stand for?

A

JavaScript
Object
Notation

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

What is the advantage to using JSON over XML?

A

JSON files look same as code used to create JS objects
eval() function in JS converts JSON to JS objects (eval used when using JSON instead of JSONP)
make sure you trust where you are getting this code from

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

What are some features of JSON?

A

Data is in name/value pairs
Data is separated by commas
Curly braces hold objects
Square brackets hold arrays

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

When would we use JSON over XML

A
  • Messages don’t need to be validated, or validating their deserialization is simple
  • You’re not transforming messages, or transforming their deserialization is simple
  • Your messages are mostly data, not marked-up text
  • The messaging endpoints have good JSON tools
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why would we want processing to happen at client end rather than our server?

A

It costs us less

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

What does asynchronous mean? What about synchronous?

A

Asynchronous means that the browser will make the AJAX request and continue doing other things. Synchronous means the browser will stop what it’s doing until the AJAX call completes (has limited use case – sneaker drops).

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

When would we use XML over JSON?

A
  • You need message validation
  • You’re using XSLT
  • Your messages include a lot of marked-up text
  • You need to interoperate with environments that don’t support JSON
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain the process of an AJAX call being sent out

A

1) Browser: Event occurs so XMLHttpRequest object created and HttpRequest sent to internet
2) Servers: Process request, send response and data through internet back to browser
3) Browser: Process data using JS and update content

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

Explain how AJAX violates security rules regarding percent escaping of reserved characters in POST data

A

Allows direct injection of hostile code into SQL schemas, which can be things such as PHP code for later retrieval and execution on the host.

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

Why can’t AJAX be trusted to do complete scanning over every communication?

A

It doesn’t escape reserved GET and POST characters. Allows direct injection of hostile code into SQL schemas.

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