-2

I have this code I got it from facebook developers and when I click on button read I have problem always return this message to me (error occured):

<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()" />

It always return this message (error occured) why?

And what does function response mean?

4

1 回答 1

0

您应该解析 response.error 或将其记录到控制台。

乍一看/me/subhinajjar:read?article应该是/me/news.reads

<meta property="og:type" content="subhinajjar:article" />

应该<meta property="og:type" content="article">

所以最有可能的错误是

未知路径组件

于 2012-05-27T12:53:05.777 回答