您好有一個問題我只能想到以非常粗糙的方式解決 - 想知道是否有其他人有任何其他想法 - 基本上我解析了一些JSON並將每個子節點附加到div但是一旦我有附加4項然後我需要在剩下的項目添加到另一個div這裏是我使用它是有效的,這僅僅是JSON的片段的JSON:
"X_bizCardServiceLinks": [
{
"name": "blogs",
"js_eval": "generalrs.label_personcard_blogslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/blogs\/roller-ui\/blog\/dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "quickr",
"js_eval": "generalrs.label_personcard_quickrlink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/quickr\/allfiles\/people\/[email protected]"
},
{
"name": "profiles",
"js_eval": "generalrs.label_personcard_profilelink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/profiles\/html\/simpleSearch.do?searchFor=dbb8fac0-42e4-102e-9409-b38b9530f95e&searchBy=userid"
},
{
"name": "activities",
"js_eval": "generalrs.label_personcard_activitieslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/activities\/service\/html\/mainpage#dashboard%2Cmyactivities%2Cuserid%3Ddbb8fac0-42e4-102e-9409-b38b9530f95e%2Cname%3DJonathan Popoola"
},
{
"name": "dogear",
"js_eval": "generalrs.label_personcard_dogearlink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/dogear\/html?userid=dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "communities",
"js_eval": "generalrs.label_personcard_communitieslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/communities\/service\/html\/allcommunities?userid=dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "wikis",
"js_eval": "generalrs.label.personcard.wikislink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/wikis\/home\/search?uid=dbb8fac0-42e4-102e-9409-b38b9530f95e&name=Jonathan Popoola"
},
{
"name": "files",
"js_eval": "generalrs.label_personcard_fileslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/files\/app\/person\/dbb8fac0-42e4-102e-9409-b38b9530f95e"
}
],
我目前嘗試以下操作:
$.each(response.X_bizCardServiceLinks, function(){
var name = this.name;
var href = this.href;
if (name != "dogear") {
$("#linkTable tr").append("<td><a href=\""+ href +"\">"+ name +"</a>");
}
else {
console.log(name, href);
}
});
正如你可以看到,一旦名字等於「折角」功能MOV es的其他,但只會返回該鏈接,而不是剩下的,任何幫助將不勝感激。