我找到了解決辦法。
代碼: -
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
<script src="http://code.jquery.com/jquery-latest.pack.js" type="text/javascript"></script>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<a onclick='postToFeed(); return false;' style="cursor:pointer;"><img src="img/xyz.jpg"></a>
<p id='msg' style="display:none"><?php echo $_REQUEST['id'] ?></p>
<script>
FB.init({appId: "your app id", status: true, cookie: true});
function postToFeed() {
var obj = {
method: 'feed',
//redirect_uri: 'YOUR URL HERE',
link: 'https://www.abc.in/',
picture: 'http://fbrell.com/f8.jpg',
name: 'abc',
caption: 'User Has Won points ',
description: 'Share Test.'
};
function callback(response) {
//document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
var id=$("p").html();
if(response['post_id']!=null)
{
$.ajax({
url:'customer.php',
data:'fbpoints='+'1'+'&customer_id='+id,
dataType:'html',
success:function(res){ alert(res);
}
});
}
}
FB.ui(obj, callback);
}
</script>
</body>
</html>
而不是'sharer.php'你爲什麼不使用'Dialog'使用,你可以做你需要輕鬆的工作飼料? – 2013-05-01 07:49:17
@AnveshSaxena可以飼料對話框工作沒有app_id或沒有Facebook頁面或應用程序? – Prince 2013-05-01 07:59:35
它需要一個應用程序ID – 2013-05-01 08:20:08