Skip to content

Instantly share code, notes, and snippets.

@imryanjay
Created April 27, 2013 18:08
Show Gist options
  • Save imryanjay/5474007 to your computer and use it in GitHub Desktop.
Save imryanjay/5474007 to your computer and use it in GitHub Desktop.
Trying to figure out what posting comments through Facebook's graph API only sometimes works
$(document).on('click', '.comment_submit', function(e) {
var $this = $(this);
var post_id = $this.closest('.box').attr('data-post_id');
var comment = $this.siblings('.comment_form').val();
$.ajax({
type: 'GET',
url: 'interactions/facebook.interaction.php',
data: {
post_id: post_id,
comment: comment,
interaction: 'commenting'
},
//dataType: 'json',
success: function(data) {
console.log('true');
},
error: function(data) {
console.log('error');
}
});
});
$interaction = $_GET['interaction'];
$post_id = $_GET['post_id'];
$comment = $_GET['comment'];
if( $interaction === 'commenting' ) {
$reply = $facebook->api('/' . $post_id . '/comments?message=' . $comment . '&access_token=' . $accessToken, 'post');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment