I'm sure there is a relatively simple way to solve this problem, but I could use some help. I have a landing page that accepts a user's email address and generates a unique URL that they can use to refer friends. I use AJAX to bind to the form and render the user's unique referral link as well as some social sharing mechanisms. For these social sharing mechanisms (Tweet, Share, etc.), I need to pass the user's dynamically generated unique referral URL to the Facebook postToFeed() script.
I used to use fb:share-button, but it seems that's now deprecated in favor of the like and posttofeed actions. In past applications and with other social network sharing functions like Twitter this was trivial because the those buttons use a href attribute.
<a href="#" id="twitter">Tweet</a>
which I can then update on the appropriate trigger event using JS or jQuery
$('#twitter').attr('href', data.link);
However, with postToFeed(), you need to pass in the information to be shared in a script (see below).
Can anyone help me figured out how I dynamically add the appropriate redirect_uri below after it has been created when the user submits their email address?
Thanks a bunch!
FB.init({appId: "", status: true, cookie: true});
function postToFeed() {
var obj = {
method: 'feed',
redirect_uri: '',
link: '',
picture: '',
name: '',
caption: '',
description: ''
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}