w6d5 Flashcards

1
Q

What does margin:auto need in order to work?

A

A width property.

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

What does javascript:void(0) do?

A

It fires the corresponding event but does not execute the default action (similar to preventDefault());

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

How can we easily toggle a class using jQuery?

A

toggleClass(altClass);

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

What is a tool to check the integrity of your HTML?

A

W3 validator.

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

How can we find classes whose name matches a string?

A

$towers.find(“li[class*=’disk’)”)

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

What is a useful way to see what exactly is going on with your CSS layout?

A

Use colored backgrounds.

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

What is an XHR?

A

XMLHttpRequest

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

What are the two ways to call $.ajax()

A

Pass is a configuration object, or a URL and an optional configuration object.

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

See an example of how to properly create an AJAX object. How is the callback being used? How many are there and why?

A

The 2 callback functions (one for error and another for success) are defined and then added as values for the success/failure keys in the configuration object.

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

What is a quick way to define the success & error AJAX callbacks?

A

Make them anonymous functions on the configuration object.

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

In what data format do servers typically respond to an XHR, despite the name?

A

JSON

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

What are the key methods to utilize JSON objects?

A

JSON.stringify(), JSON.parse(), jQuery.parseJSON

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

What are convenience methods for AJAX?

A

Each takes a URL, an optional data object, and an optional callback for a successful request (note there is NO error handling)

$.get( ‘/data/people.html’, function( html ){
$( ‘#target’ ).html( html );
});

$.post( ‘/data/save’, { name: ‘Rebecca’ }, function( resp ) {
console.log( resp );
});

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

How can we pass (form) data t an AJAX request?

A

By giving it as the ‘data’ key, after serializing it in a query string format:

$( ‘form’ ).submit(function( event ) {
event.preventDefault();

var form = $( this );

  $.ajax({
    type: 'POST',
    url: '/data/save',
    data: form.serialize(),
    dataType: 'json',
    success: function( resp ) {
      console.log( resp );
    }
  });
});
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When we capture the result of $.ajax() in a variable, what is that called?

A

It is called a jqXHR

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