Reputation: 1109
I have the following json results being returned to me and I can't work out how to loop over the success results. Here is an example of what is being returned
{"ERRORS":[],"SUCCESS":["7336","7337","7356"]}
This is where I have got to so far but it's not working
jQuery.each( data.success, function( i, val ) {
console.log(val);
});
Any help would be appreciated
Upvotes: 0
Views: 52
Reputation: 7383
Make success same case.
jQuery.each( data.SUCCESS, function( i, val ) {
console.log(val);
});
JavaScript is case sensitive. I would recommend using lower case letters (camelCase) when working with json - but it's a matter of preference of course.
Upvotes: 3
Reputation: 1531
You don't need the parameter passing when using jQuery.each.
Try this:
jQuery.each(data.SUCCESS, function() {
console.log(this);
});
Upvotes: -1