How to comment on embedded facebook post on a website without leaving it -
i made fanpage , have used embedded code 1 of post of fanpage website.
so shows post on website , number of likes show current existing comments particular post had got. right displays comment button , if click take me fanpage sake of comment.
so heres need
1 - comment on embedded post without leaving website facebook.
2 - displaying current existed comments ..
the image right
thats simple. first, need login user , ask publish_stream permission. after user logged in, display button triggers function named comment, passing id (corresponding object user going comment to) .
you need input field inserting comment (of course), , using jquery .value value of input field .
ps: specify name , id on message input field. dont remember wich 1 is, put both of them .
after getting variables, call fb.api, specifing variables id , comentario response handling result (if want), can try reload comment plugin, or refreshing page .
function comment(id) { var id = id; var comentario = document.getelementbyid("message").value; fb.api("/"+id+"/comments","post", { "message": comentario }, function (response) { if (response && !response.error) { alert('comentado !'); } else { alert('erro !'); } }); $("#atividade").html('comentado'); }
that simple , fun, need authorization facebook platform ask users publish_stream permissions before production .
Comments
Post a Comment