/    Sign up×
Community /Pin to ProfileBookmark

Hey guys,

I am getting the following response from Ajax:

[CODE]
[{“Account Name”:[{“id”:”944ef382-becc-102b-baf8-000c29f242f5″,”priority”:”1″,”creator_id”:”Chris Kelly”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 18, 2008 @ 04:21 PM”,”date”:”18 AUGUST”,”note”:”I will note too!!”},{“id”:”753d3736-becc-102b-baf8-000c29f242f5″,”priority”:”0″,”creator_id”:”M Patel”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 18, 2008 @ 04:20 PM”,”date”:”18 AUGUST”,”note”:”One more note of the day!”},{“id”:”906d07a4-bc72-102b-ad39-000c29bdb9c5″,”priority”:”0″,”creator_id”:”M Patel”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 15, 2008 @ 04:32 PM”,”date”:”15 AUGUST”,”note”:”Moon is good at this”},{“id”:”7c7b2c6d-bc72-102b-ad39-000c29bdb9c5″,”priority”:”0″,”creator_id”:”M Patel”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 15, 2008 @ 04:31 PM”,”date”:”15 AUGUST”,”note”:”This is a normal notes”},{“id”:”76eb582c-bc72-102b-ad39-000c29bdb9c5″,”priority”:”1″,”creator_id”:”M Patel”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 15, 2008 @ 04:31 PM”,”date”:”15 AUGUST”,”note”:”This is high!”},{“id”:”6c06f918-bc72-102b-ad39-000c29bdb9c5″,”priority”:”2″,”creator_id”:”M Patel”,”object_id”:”32d79cfd-b6f6-102b-a73c-000c29bdb9c5″,”created_at”:”August 15, 2008 @ 04:31 PM”,”date”:”15 AUGUST”,”note”:”This account sucks!”}]}]
[/CODE]

Here is the Javascript:

[code=php]
var json = eval(‘(‘ + request.responseText + ‘)’);

alert(json.length); // Output is 1
alert(json[0].length); // Output is undefined
[/code]

So, how can I get the count of all array elements inside “Account Name”?

Any possible help / tips will be highly appreciated! ?

Thank you

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@DokAug 22.2008 — [CODE]alert(json[0]['Account Name'].length);[/CODE]
×

Success!

Help @nirali35 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...