-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcp-index.html
53 lines (45 loc) · 1.47 KB
/
cp-index.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
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Javascript oAuth</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
<script src="js/cookie.js"></script>
<script src="js/twitterLogin.js"></script>
<link href="css/style.css" rel="stylesheet" />
<script>
function getTweets() {
var xhr = new XMLHttpRequest();
xhr.open('post',"https://stream.twitter.com/1.1/statuses/filter.json");
xhr.setRequestHeader("Content-type","application/jsonp");
// Track the state changes of the request.
xhr.onreadystatechange = function(){
// Ready state 4 means the request is done.
console.log('readyState',xhr.readyState);
if(xhr.readyState === 4){
if(xhr.status === 202){
console.log('SUCCESS',xhr.responseText);
}else{
console.log('FAILURE',xhr);
}
}
}
//BEGIN MY STUFF
console.log('BEGIN MY STUFF');
mySubmission = {
track: "barack obama"
};
console.log('send()');
xhr.send(JSON.stringify(mySubmission));
}
</script>
</head>
<body>
<div class="loginDiv">
<div id="twitterlogin">Twitter</div>
</div>
<div style="clear:both;" id="tweets"></div>
</body>
</html>