0

the headline says everything. I get always this error: "method" is a required parameter for FB.ui(). But method is set to 'feed'

Is it because i currently working local on my machine and not on a really server?? App is also registered in facebook.

Any idea?

<span id='share'>SHARE</span> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({appId: '2907534********', status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <script type="text/javascript"> $(document).ready(function(){ $('#share').click(function(e){ e.preventDefault(); FB.ui({ method: 'feed', name: 'This is the content of the "name" field.', link: ' http://www.hyperarts.com/', picture: 'http://www.hyperarts.com/external-xfbml/share-image.gif', caption: 'This is the content of the "caption" field.', description: 'This is the content of the "description" field, below the caption.', message: '' }); }); }); </script> 
1
  • This looks like an issue with your application since any of sharing options doesn't work with your APP_ID (taken from site specified by link) Please ensure your application configured correctly and not blocked. Commented Jan 30, 2012 at 6:38

3 Answers 3

2

The $('#share').click(function(e){ section of code should go into the window.fbAsynchInit call to ensure the framework is loaded prior to assign a click event to something that utilizes the FB.

Sign up to request clarification or add additional context in comments.

Comments

1

I tested that very same code with my own app ID and it worked fine for me. The only difference is that I changed name, caption, and description to just be 'This', and I fixed a syntax issue at the end.

Are you sure this bit of code is the source of your error?

1 Comment

yes i also just copied this example out of an tutorial... what was this for an syntax issue?? You tested it local or on an live server??
0
  • you must be online on server ( really server )
  • if you didn't have Facebook id in this line FB.init({appId: '2907534********', status: true, cookie: true, xfbml: true}); you must have one from this url : https://developers.facebook.com/ or search in how to create facebook app an example for ( how to create facebook app ) hyperarts.com/blog/how-to-create-facebook-application-to-get-an-app-id-for-your-website/
  • but if you already have facebook id and already know how to create app , you must put the code in the top , on the same file that you put on facebook canvas ,

as for example if you insert in canvas ( https://www.example.com/test.php ) and you must put this code at test.php

I hope your problem will be solved really soon!

1 Comment

check this url may be help you : hyperarts.com/blog/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.