Skip to content

Instantly share code, notes, and snippets.

@rpearce
Created September 22, 2012 17:55
Show Gist options
  • Save rpearce/3767176 to your computer and use it in GitHub Desktop.
Save rpearce/3767176 to your computer and use it in GitHub Desktop.
// ...
events: {
'click .facebook-share' : 'postToFeed',
},
postToFeed: function() {
FB.init({appId: fb_app_id, status: true, cookie: true});
// calling the API ...
var obj = {
method: 'feed',
link: 'http://www.google.com',
picture: 'http://athena.cornell.edu/images/rovers/rover_sundial.jpg',
name: 'My text about ' + this.model.get('something_interesting'),
caption: '',
description: 'Sweet! This is so great and about something interesting!',
redirect_uri: 'your redirect URI'
};
var self = this;
FB.ui(obj, function(response) {
self.callback(response);
});
},
callback: function(response) {
// callback where you do something with the response
}
// ...
var fb_app_id = 'your facebook application id';
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment