jquery와 javascript를 사용하여 xml 작업을하고 있습니다. 나는 xml을 ajax를 사용하여 가져온 다음 조작하고 싶다. appendChild는 IE8에서 문제가된다. IE8 appendChild to XML 문제 : 형식이 일치하지 않습니다.
이
은 자바 스크립트입니다 :// How i get xml
$.ajax({
url: production_get,
dataType: "xml",
success: function(data) {
input_xml=data;
}
});
// how i try to append a new node to
new_user_node = document.createElement('user');
new_user_node.setAttribute('id',new_user_id);
new_user_node.setAttribute('label',new_user_label);
response=$(input_xml)[0].getElementsByTagName("response")[0];
response.appendChild(new_user_node); // <- type mismatch
XML 마크 업
<response>
<user id="123" label="John" />
</response>
이 모든 브라우저에서 잘 작동하지만 IE 보고서 그 : 형식이 일치. 나는 IE8에서도 작동하지만 콘솔은 오류를보고한다. IE7에서는 오류 팝업이 나타난다.
에
$.parseXML()
http://api.jquery.com/jQuery.parseXML/
더 많은 예제를 사용할 필요에
은 추가 할 수있는 XML 문서를 만들려면? – Coder$ .parseXML (data)을 사용하여 xml : success : function (data) {input_xml = data;}을 가져 오려고하면 내용이 – Mike