Reputation: 1862
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>
Upvotes: 0
Views: 1637
Reputation: 41
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!
Upvotes: 0
Reputation: 31870
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.
Upvotes: 2
Reputation: 1906
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?
Upvotes: 1