-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsdemo.html
42 lines (37 loc) · 893 Bytes
/
jsdemo.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Testing a JavaScript API</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('body').append('<p>Printed using dot.append function</p>');
console.log('this is a debug statement');
var venues = {};
$.ajax({
url :'http://classes.dma.ucla.edu/Summer13/160-1/api//live-shows.php?format=json',
dataType: 'json',
success: function(data) {
for (var i in data) {
var concert = data[i];
$('body').append('<p><a href="'+concert.url+'">'+concert.artist+'</a></p>');
if (venues[concert.venue] === undefined)
{
venues[concert.venue] = 1;
}
else
{
venues[concert.venue]++;
}
}
console.log(venues);
}
})
});
</script>
</head>
<body>
<h1>Testing a JavaScript API</h1>
</body>
</html>