我有一个Facebook应用程序,其批准的操作'响应'和对象'问题'。当我单击我为我的操作创建的按钮时,操作数据显示在我的时间轴中,但该对象的元数据不会显示,并且我的新闻Feed中没有显示任何内容。可能导致这种情况的原因是什么?
行动守则:
function postResponse(num,questionnum) {
var responsestr = document.forms['frm'+num].responsestr.value;
FB.api('/me/smartassbuddha:respond_to' + question=http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=1&qn='+questionnum+'&re='+encodeURI(responsestr),'post',
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post was successful! Action ID: ' + response.id);
}
});
}
对象元数据:
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# smartassbuddha: http://ogp.me/ns/fb/smartassbuddha#">
<meta property="fb:app_id" content="213040448788033" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="smartassbuddha:question" />
<meta property="og:url" content="http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=<?=$chapter?>&qn=<?=$quenum?>&re=<?=$responsestr?>" />
<meta property="og:title" content="Chapter 1 - Inspiration" />
<meta property="og:description" content="<?=$questions[$quenum]?>" />
<meta property="og:image" content="http://www2.3tierlogic.com/smartassbuddha/images/logo.jpg" />
<meta property="smartassbuddha:response" content="<?=$responsestr?>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
答案 0 :(得分:0)
你错过了一个问号(显然是一个刻度线)。您的网址编码也存在问题。
看起来应该是这样的:
var responsestr = document.forms['frm'+num].responsestr.value;
var url='http://www6.3tierlogic.com/campaigns/smartassbuddha/chapter.php?cp=1&qn=' + questionnum + '&re=' + responsestr;
FB.api('/me/smartassbuddha:respond_to?question=' + encodeURIComponent(url),'post', function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post was successful! Action ID: ' + response.id);
}
});