我有以下代码从文档中获取注释,问题是它只需要第一级注释,但实体类型下的注释未被提取,任何想法如何更改代码获取还有实体类型下的注释?
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)
}
});
答案 0 :(得分:1)
尝试替换
{p>var entityAnnotation = jQuery(entityTypes).find("Annotation");
.find("Annotation")
1>} s <{1}}
jsfiddle http://jsfiddle.net/y6XgY/502/