这是正在返回的对象。如何访问javascript中对象的内部对象
Object:
contributors_enabled: false
created_at: "Sat Apr 18 02:20:51 +0000 2009"
...
status: Object
...
verified: false
正如你可以看到有2个对象。父母,然后是内部称为“状态”的对象。
在javascript中,如何访问“状态”对象。我试过object.status
,它返回null。
真正的代码:
function get_data($id) {
global $tmhOAuth;
$code = $tmhOAuth->request('POST', $tmhOAuth->url('1/users/lookup.json', ''), array('user_id' => $id));
if ($code == 200) {
$data = json_decode($tmhOAuth->response['response'], true);
return $data;
} else {
outputError($tmhOAuth);
}
}
if (!empty($_POST) && !is_null($_POST)) {
extract($_POST); //imports $id;
$data = get_data($id);
exit(json_encode($data));
}
$.post(
'/twitauth/app.php',
data,
function(response) {
console.log(response);
},
'json'
);
我们能有一个[的jsfiddle(http://jsfiddle.net/),好吗? – Ryan
我猜这只是伪代码,因为它看起来不像一个有效的JS对象? – adeneo
这是CoffeeScripts中的一个吗?或伪代码? – Joseph