我試圖從由bit.ly API返回的JSON數組中獲得的價值從JSON數組檢索數據
的迴應是:
{"status_code": 200, "data": {"bundle": {"og_image": null, "bundle_owner": "user", "created_ts": 1423596727, "description": "", "links": [{"updated_by": null, "title": "", "display_order": 0, "lm": 1423597992.378417, "ts": 1423597992.378417, "comments": [], "aggregate_link": "http://bit.ly/LmvF", "long_url": "http://google.com/", "link": "http://bit.ly/1AUeg5k", "preview": 1, "added_by": "rentthesun"}], "title": "Barcelona 226", "collab": [], "private": true, "inv_collab": [], "last_modified_ts": 1423597992, "bundle_link": "http://bitly.com/bundles/myuser/2", "preview": true}}, "status_txt": "OK"}
我想「環節的價值「
我的代碼:
$.getJSON("https://api-ssl.bitly.com/v3/bundle/link_add?", {
"access_token": "MY_TOKEN",
"bundle_link": "https://bitly.com/bundles/user/2",
"link": raw_url,
}, function(response) {
$("#link-container").show("fast");
link = "<a href=\"" + response.data['bundle']['links'].link[0] + "\" target=\"_blank\">" + response['data']['bundle']['links'].link[0] + "</a>";
$("#link").html(link);
});
我怎樣才能縮短的鏈接?
如何訪問任何Javascript數組/對象成員?這不是特殊的,因爲它是JSON – 2015-02-10 21:17:25