forked from microsoft/TypeScriptSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfb.js
More file actions
31 lines (26 loc) · 961 Bytes
/
Copy pathfb.js
File metadata and controls
31 lines (26 loc) · 961 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
///<reference path="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js" />
///<reference path="http://connect.facebook.net/en_US/all.js" />
// initialize the library with the API key
FB.init({ appId: '349900301735115' });
// fetch the status on load
FB.getLoginStatus(handleSessionResponse2);
$('#login').bind('click', function () {
FB.login(handleSessionResponse);
});
$('#logout').bind('click', function () {
FB.logout(handleSessionResponse);
});
function handleSessionResponse2() { }
// handle a session response from any of the auth related calls
function handleSessionResponse() {
FB.api('/me', function (response) {
console.dir(response);
//$('#user-info').html(response.id + ' - ' + response.name);
});
FB.api('/me/picture', function (response) {
console.dir(response);
var img = document.createElement('img');
img.src = response;
document.body.appendChild(img);
});
}