forked from rmurphey/jqfundamentals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstaff.js
63 lines (51 loc) · 1014 Bytes
/
staff.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
$(document).ready(function() {
/*
$('#staff li').one('click', function(e) {
var $li = $(this);
var id = $li.attr('data-staffId');
$.ajax({
type : 'GET',
dataType : 'json',
url : '/json/staff.json',
success : function(resp) {
var $p = $('<p/>')
.insertAfter($li.find('h2'))
.html(
resp[id].lastName + ' is ' +
resp[id].age
);
$li.click(function() {
$p.toggle();
});
}
});
});
*/
/*
var peopleCache,
showDetails = function($li, d) {
peopleCache = peopleCache || d;
var id = $li.attr('data-staffId');
$li.find('h2')
.after('<p>' +
d[id].lastName + ' is ' +
d[id].age +
'</p>');
};
$('#staff li').one('click', function() {
var $li = $(this);
if (peopleCache) {
showDetails($li, peopleCache);
return;
}
$.ajax({
type : 'GET',
url : '/json/staff.json',
dataType : 'json',
success : function(resp) {
showDetails($li, resp);
}
});
});
*/
});