0
我正在用jQuery創建一個Facebook頁面,我想過濾一篇文章。但我似乎無法弄清楚如何。我對jQuery不是很有經驗,但是學習。選擇第一個JSON數組+按字過濾
所以我想過濾出#weekhap和#標籤這樣的詞,這樣所有者就更容易管理Facebook上的所有內容。這甚至有可能嗎?我使用此代碼:
function fbFetchWeekhap(){
var url = "https://graph.facebook.com/reindersrobin/posts&access_token=AAAE6AYdEq9sBALPKSIgPUDrdQIy2aHZBQSQI9DuhY1yx9z1ZC1p8TVLTCCIuZBZAgw1ann9iyghVGPLwsTRwOJZAC8a6M53YZD";
$.getJSON(url,function(json){
console.log(json)
$.each(json.data,function(i,fb){
var html = fb.message;
$("#weekhap").html(html);
});
});
};
Facebook的JSON是產生這樣的:
"data": [
{
"id": "401455409880061_417873164904952",
"from": {
"name": "ReindersRobin",
"category": "Bar",
"id": "401455409880061"
},
"message": "#weekhap",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/401455409880061/posts/417873164904952"
},
{
"name": "Like",
"link": "http://www.facebook.com/401455409880061/posts/417873164904952"
}
],
"privacy": {
"description": "Public",
"value": "EVERYONE"
},
"type": "status",
"created_time": "2012-03-30T05:58:09+0000",
"updated_time": "2012-03-30T05:58:09+0000",
"comments": {
"count": 0
},
"is_published": true
},
謝謝,這工作:-),但現在我需要弄清楚如何顯示包含標籤的帖子。但生病先嚐試一下我自己。 – user1268465 2012-03-30 07:26:29
我似乎無法弄清楚,我想使用IndexOf的權利? – user1268465 2012-03-30 09:15:02