1
嗨想知道,如果有人能幫助我 - 我想做一個Ajax調用來檢索一些JSON數據。數據回來很好,但我無法獲取任何數據。我有工作的JSON是:問題JSON解析與jQuery
{
"X_lconn_userid" : "dbb8fac0-42e4-102e-9409-b38b9530f95e",
"uid": "JonathanPopoola",
"key": "06b4b957-4941-4d68-80c4-83306c551740",
"fn": "Jonathan Popoola",
"photo": "https://dc3-epag-03.tm-gnet.com/profiles/photo.do?key=06b4b957-4941-4d68-80c4-83306c551740&lastMod=1295913640000",
"adr": {"work": {"locality": "", "region": "",
"country_name": ""}},
"tel": {"work": "0207 293 3000"},
"email": { "internet": "[email protected]", "X_notes": ""},
"title": "",
"employeeTypeDesc": "",
"org": "",
"X_building_name": "Canary Wharf",
"X_building_floor": "23",
"X_office": "",
"X_blogUrl": "",
"X_inDirectory": "true",
"X_bizCardShowPhoto": true,
"X_bizCardSTAwareness": false,
"X_bizCardSecureSTAwareness": true,
"X_bizCardLocation": { "unsecure": "" , "secure": ""},
"X_bizCardSTInputType": "email",
"X_bizCardSTStatusMsg": true,
"X_STChatAction": true,
"X_STCallAction": true,
"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"}],
"X_allowEvalLabel": true
}
我目前使用的代碼是:
function getvCard (uid) {
//will need to build url and include uid for live server !
$.ajax ({
type: "GET",
url: "http:\/\/cw-epuip-d01.tm-gnet.com:10040/EnhancedTheme/themes/html/Enhanced/js/modules/jpopoola.json",
dataType: "application/json",
timeout: 10000,
success: function(data){
console.log(data.photo);
},
error: function(e, xhr) {
console.log("error" + e);
}
});
任何人都可以提供一些線索我怎麼能JSON數據中訪問一個項目。
在此先感謝。
確定的歡呼聲,但數據類型would'nt只用JSON工作 - 不停地打錯誤回調 – jonnyhitek 2011-01-26 13:43:32