I am adding a link to my site that will allow users to share what happened on the page on their Facebook wall.
I use the JavaScript Javascript API for this. I have the following code in my head.
<script src="http://static.ak.fbcdn.net/connect/en_US/core.debug.js" type="text/javascript"></script>
Later in the body, I call the code to publish to the user stream.
window.fbAsyncInit = function() {
FB.init({
appId: "XXXXXXXXXXX",
status: true,
cookie: true,
xfbml: true,
level : "debug"
});
};
streamPublish = function(){
var session = Session.get('eres_user_data');
var argumentsURL = "";
var confirmFacebookTitle = "";
var confirmFacebookMessage = "";
if (session.promoCode != null && session.promoCode != ""){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&promotioncode="+session.promoCode+"view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "It time to play at "+session.propName+"!";
confirmFacebookMessage = "I just saved "+ confirmationMod_session.savings+" by using the "+confirmationMod_session.promoName+" online at "+confirmationMod_session.propName+"!";
}
else if (session.showHotDeals == "Y"){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"view=ratecal&showhotdeals=y&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "I booked a smoking hot deal at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" using the 'Hot Deals Calendar'. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
else if (session.packageCode != null && session.packageCode != ""){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&packagecode="+session.packagecode+"view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "I booked a "+session.packageName+" package deal at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" online. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
else{
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "It time to play at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" online. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
FB.ui(
{
method: 'stream.publish',
display:'dialog',
message: 'test',
attachment: {
name: confirmFacebookTitle,
caption: '',
description: confirmFacebookMessage,
'media': [{
'type': 'image',
'src': 'http://www.caesars.com/images/casinos/'+session.propCode+'MET_alt.png',
'href': argumentsURL
}],
href: argumentsURL
},
action_links: [
{ text: 'Find Rates', href: argumentsURL}
],
user_message_prompt: 'Tell your friends about your getaway.'
},
function(response) {
}
);
}
When the user clicks the “sharing” link, a facebook window appears, but there is only a text error. "An error has occurred. Please try again later." that’s all that is shown along with the url
https://www.facebook.com/dialog/stream.publish?action_links=[{%22text%22:%22Find%20Rates%22,%22href%22:%22https://www.totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}]&attachment={%22name%22:%22It's%20time%20to%20play%20at%20Harrah's%20Metropolis!%22,%22caption%22:%22%22,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%20lowest%20rates,%20and%20so%20easy%20to%20book.%20Wish%20me%20luck!%22,%22media%22:[{%22type%22:%22image%22,%22src%22:%22http://www.caesars.com/images/casinos/METMET_alt.png%22,%22href%22:%22https://www.totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}],%22href%22:%22https://www.totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}&display=popup&locale=en_US&message=test&next=http://static.ak.fbcdn.net/connect/xd_proxy.php%23cb%3Df2b8d16234%26relation%3Dopener%26frame%3Df2f644938%26result%3D%2522xxRESULTTOKENxx%2522&sdk=joey&user_message_prompt=Tell%20your%20friends%20about%20your%20getaway.
? javascript, , . , . " , " .