0

How do I get value.email from only position 0 of the index?

I only want the value.email from the first item returned in my JSON call.

$.each(data.DATA, function(index, value) {
    console.log(value.EMAIL);

});

I have tried the following but this generates an error.

$.each(data.DATA[0], function(index, value) {
    console.log(value.EMAIL);

});
4

1 回答 1

4

Lose the $.each, just do console.log(data.DATA[0].EMAIL).

于 2012-08-28T13:50:20.860 回答