Hey bạn bè tôi đang sử dụng javascript sdk để đăng trên người sử dụng bạn bè tường với jQuery facebook đa người bạn chọn tuy nhiên tôi nhận được lỗi này friendId.split không phải là một chức năng. Đây là mã của tôiJavascript tách không phải là một chức năng
function recommendToFriend(pic, url, friendId, fromName)
{
alert(friendId);
var friendList ;
pFriend = new Array();
pFriend = friendId.split(',');
for(x in pFriend)
{
alert(pFriend[x]);
var publish = {
method:'feed',
picture:pic,
link:url,
name:'SHARP Product Recommend',
caption: fromName + 'has recommend a product to you via Sharp Expert lounge',
};
FB.api('/'+pFriend[x]+'/feed', 'post', publish, function(resp) {
if(!response || response.error)
alert('Unable to share');
else
alert('Successfully posted to firends wall');
});
}
}
Trong hộp cảnh báo tôi đã dấu phẩy tách friend IDS vì vậy tôi sử dụng phân chia chức năng bài viết trên mỗi bức tường người dùng riêng rẽ i dont know whats sai ở đây hãy giúp tôi
lẽ Hầu hết đây là vì 'friendId' không phải là một chuỗi nhưng một mảng. – VisioN
'console.dir (friendId)' hoặc 'console.log (typeof friendId)' cho bạn biết điều gì? 'alert' là phương pháp gỡ lỗi tồi tệ hơn bạn có thể chọn. –
console.log (typeof (friendId)) trả về đối tượng –