0

I have experienced a problem with facebook open graph (the cook action and recipe object).here is my url http://www.webcoachbd.com/tester.html When i click "Cook" it shows an alert "Error occurred [object Object]". I have seen the related topics and tried those,but problem not solved. This is my tester.html

<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# fb: http://ogp.me/ns/fb# rejoanxxxx: http://ogp.me/ns/fb/rejoanxxxx#">
<meta property="fb:app_id" content="12xxx" /> 
<meta property="og:type"   content="rejoanxxxx:recipe" /> 
<meta property="og:url"    content="http://www.webcoachbd.com/tester.html" /> 
<meta property="og:title"  content="Sample Recipe" /> 
<meta property="og:image"  content="http://www.webcoachbd.com/images/animl136.jpg" /> 


<script type="text/javascript">
function postCook()
{
  FB.api(       '/me/rejoanxxxx:cook?recipe:http://www.webcoachbd.com/tester.html',
    'post',
    function(response) {
       if (!response) {
          alert('Error occurred : No Response');
       } else if (response.error) {
          alert('Error occurred : ' + response.error);
       } else {
          alert('Cook was successful! Action ID: ' + response.id);
       }
    });
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
  FB.init({
    appId      : '[123xxxxxxxx]', // 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>

<h3>Stuffed Cookies</h3>
<p>
<img title="Stuffed Cookies" 
     src="http://www.webcoachbd.com/images/animl136.jpg" 
     width="550"/>
</p>

<br>
<form>
<input type="button" value="Cook" onclick="postCook()" />
</form>

and application basic setting is App Domains:webcoachbd.com Site URL:http://webcoachbd.com

I check my url (http://www.webcoachbd.com/tester.html) with facebook debugger,do not show any error or warning. Is there are any solution to this problem?Please help.

4

2 回答 2

1

You have used a colon (:) instead of an equals sign (=) when posting.

Change this: /me/rejoanxxxx:cook?recipe:http...
To this: /me/rejoanxxxx:cook?recipe=http...

于 2012-09-24T10:06:20.827 回答
0

When i click "Cook" it shows an alert "Error occurred [object Object]".

The alert method can not display object structures, so you just get [object Object] in that debug attempt.

Use console.log(response.error) instead, and then have a look into your browser’s JavaScript console to see what the actual error is.

于 2012-09-24T08:13:49.647 回答