Reputation: 772
I have a json response string as follows:
[
{
"0":
{
"total":"2.00"
},
"PaymentCollection":
{
"emp_id":"E0004"
}
}
]
and my jQuery function is
$.each(resp,function(indx,obj){
alert(obj.0.total);
});
Unfortunately the alert is not working.. please help
Upvotes: 1
Views: 48
Reputation: 15104
.0
is not valid in javascript (an identifier can't start with a digit). You can use the "array notation" : alert(obj["0"].total);
Upvotes: 1