我有这个代码我从Facebook开发人员那里得到它,当我点击按钮读取时我有问题总是将此消息返回给我(发生错误):
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# subhinajjar:
http://ogp.me/ns/apps/subhinajjar#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="*****" />
<meta property="og:type" content="subhinajjar:article" />
<meta property="og:title" content="3eesho reading club" />
<meta property="og:url" content=document.location.href>
<script type="text/javascript">
function postarticle()
{
FB.api(
'/me/subhinajjar:read?article',
'post',
{ article: 'document.location.href' },
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('read was successful! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '*****', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
</p>
<br>
<form>
<div class="fb-login-button" data-show-faces="true" data-width="200" data-max-rows="1" scope="publish_action"></div>
<input type="button" value="read" onclick="postarticle()" />
它总是返回此消息(发生错误)为什么?
功能响应是什么意思?
答案 0 :(得分:0)
您应该解析response.error或将其记录到控制台。
乍一看/me/subhinajjar:read?article
应为/me/news.reads
<meta property="og:type" content="subhinajjar:article" />
应为<meta property="og:type" content="article">
所以很有可能错误是
未知路径组件