How to access JSON Array elements returned from an AJAX response
how to access JSON array elements for the following JSON Code? further how do i calcula开发者_如何转开发te the size of the returned object array?
[
{
lastInvAmt: 0
bwHrs: 0
nbwHrs: 0
unbilledAmt: 0
unbilledHrs: 0
dbID: 0`
},{
lastInvAmt: 0
bwHrs: 0
nbwHrs: 0
unbilledAmt: 0
unbilledHrs: 0
dbID: 0`
}]
Why can't you assign it to variable? Or I don't understand anything? :)
edited to work with json string
var ar = eval('[
{
lastInvAmt: 0
bwHrs: 0
nbwHrs: 0
unbilledAmt: 0
unbilledHrs: 0
dbID: 0
},{
lastInvAmt: 0
bwHrs: 0
nbwHrs: 0
unbilledAmt: 0
unbilledHrs: 0
dbID: 0
}]');
Why do you have single quote dbID: 0`. Is it spelling error?
精彩评论