我试图从由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