我正在使用jQuery和JavaScript的xml工作。我使用ajax导入xml然后我想操纵它,appendChild在IE8中是一个问题。IE8 appendChild XML问题:类型不匹配
这是JavaScript:
// 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中出现错误弹出窗口
在哪一行这个错误出现? – Coder
我改进了原始问题的细节 – Mike