[英]Get value inside nested object using jQuery
I have the following bit of code 我有以下一点代码
for (var i = 0; i < $scope.d.results.length; i++) {
console.log($scope.d.results[i]);
}
which returns this: 返回这个:
I would like to get the value of the Name field out of this object but I can't think of the syntax to get at it. 我想从这个对象中获取Name字段的值,但我想不出要获得它的语法。 I've tried a few things with no luck.
我尝试了一些没有运气的事情。 Can someone explain how to dig down 2 levels and get at it?
有人可以解释如何挖掘2级并获得它吗? Thanks!
谢谢!
You can use 您可以使用
$scope.d.results[i].Name
As, $scope.d.results[i]
returns an object which contains the Name
, you can use above syntax to get it from the object. 因为,
$scope.d.results[i]
返回一个包含Name
的对象,你可以使用上面的语法从对象中获取它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.