-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
39 lines (36 loc) · 765 Bytes
/
index.html
File metadata and controls
39 lines (36 loc) · 765 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Data Vis</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<script>
var getData = function(){
$.ajax({
type: "GET",
url: "http://search.twitter.com/search.json?q=fox",
dataType: "JSONP",
success: function(data){
displayData(data);
},
error: function(){
console.log("nope");
}
});
}
var displayData = function(data){
$.each(data.results, function(index, result) {
var $dataList = $('<li></li>');
console.log(result.from_user);
$dataList.text(result.from_user + " says: " + result.text);
$('.data').append($dataList);
});
}
$(document).ready(function(){
getData();
});
</script>
<div class="main"><ul class="data"></ul></div>
</body>
</html>