Repository navigation
Expand file tree
/
Copy pathfoursquare_map.html
More file actions
52 lines (52 loc) · 1.8 KB
/
Copy pathfoursquare_map.html
File metadata and controls
52 lines (52 loc) · 1.8 KB
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
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<article>fuck you</article>
</body>
<script>
uri = window.location.href;
search = '#access_token=';
start = uri.indexOf(search);
access_token = false;
if (start > 0) {
start = start + search.length
access_token = uri.slice(start);
}
if(access_token){
$.ajax({
url:'https://api.foursquare.com/v2/users/self/checkins',
data: {oauth_token:access_token},
success:function(checkin_resp) {
//console.dir(user_data);
//$('article').text('Hello '+user_data.response.user.firstName);
var count = checkin_resp.response.checkins.count;
var checkins = checkin_resp.response.checkins.items;
for(var i = 0; i < checkins.length; i++) {
var state = checkins[i].venue.location.state;
console.log(state);
}
console.log(checkin_resp);
},
error: function(jqXHR, textStatus, errorThrown){
console.error(errorThrown);
}
});
} else {
// print a login button
client_id = 'XL4HOUSWWCZOXBQUISKPB02M01YO1LDJO3ZPBC5ROY24CVT3';
redirect_uri = 'http://julieannhorvath.com/foursquare_map.html';
auth_url = 'https://foursquare.com/oauth2/authenticate?client_id=' + client_id + '&response_type=token&redirect_uri=' + redirect_uri;
$('article').html('<a href="' + auth_url + '" target="_new"><img src="https://playfoursquare.s3.amazonaws.com/press/logo/connect-blue@2x.png"></a>');
}
</script>
<script>
/*$.ajax({
url: "https://api.foursquare.com/v2/users/self/checkins",
context: document.body
}).done(function() {
console.log("done");
}); */
</script>
</html>