PHP到JQUERY - 访问JSON元素

I'm sending the following from PHP to JSON

 print json_encode(array('success' => TRUE, 'status' => array('username' => 'valid', 'password' => 'valid', 'token' => $tokenhash)));

I can access success in JQUERY like this for example:

        function (data) {
            alert(data.success);

How can I access token? I tried alert(data.success.token); Note: just using alert to see if I can hook into the required value.

Is there a syntax similar to data.success that I can use for token?

thx

Isn't it data.status.token that you are looking for ?

data.success is just grabbing the success key from your array. Looks like you want data.status.token.