0
jquery 필터 함수를 사용하려고하는데 XML을 파싱했지만 문제가 있습니다.XML 데이터 가져 오기 - Jquery - 필터
<root>
<data name="0121C395-AFCE-49C8-A163-55E24325D691" xml:space="preserve">
<value>Report an incident</value>
</data>
<data name="0121C395-AFCE-49C8-A163-55E24325D691_descr" xml:space="preserve">
<value>In this service it's possible to report incidents.</value>
</data>
<data name="0121C395-AFCE-49C8-A163-55E24325D691_short" xml:space="preserve">
<value>Report Incident</value>
</data>
</root>
을 그리고 내 JQuery와는 다음과 같습니다 : 내 XML은 다음과 같습니다
$(document).ready(function(){
$.ajax({
type: "GET",
url: "http://localhost/servicemarket/ReachOut/Services.xml",
dataType: "xml",
success: function(xml){
var dataVal = $(xml).find('data').filter(function(){
return $('data', this).attr('name') == '0121C395-AFCE-49C8-A163-55E24325D691';
});
dataVal.each(function(index, data){
console.log($(data).find('value').text());
});
},
error: function() {
alert("An error occurred while processing XML file.");
}
});
});
내 목표는 들어오는 데이터의 속성에 따라 노드 값을 얻는 것입니다. 모든 도움을 많이 받으실 수 있습니다! :) 감사합니다!