我有以下代码,它从文档中获取注释,问题是它只获取第一级注释,但未获取实体类型下的注释,知道如何更改代码来获取还有实体类型下的注解?
http://jsfiddle.net/y6XgY/501/
$.ajax({
url: 'http://services.odata.org/V4/(S(1j4xrnlnwnnmvagwtgl2envc))/TripPinServiceRW/$metadata',
success: function (data) {
console.log('received data: ' + data);
debugger;
var annotations = jQuery(data).find("Annotations");
var entityTypes = jQuery(data).find("EntityType");
var entityAnnotation = jQuery(entityTypes).find("Annotations");
console.log("annotations: " + annotations)
}
});
最佳答案
尝试替换
var entityAnnotation = jQuery(entityTypes).find("Annotation");
在 .find( 末尾不带
s “注释”) for varentityAnnotation = jQuery(entityTypes).find(“Annotations”);
jsfiddle http://jsfiddle.net/y6XgY/502/
关于javascript - 从元数据中获取子节点的条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29349848/