jqueryとjavascriptを使用してxmlに取り組んでいます。ajaxを使用してxmlをインポートしてから操作したいのですが、appendChildはIE8の問題です。
これは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ではエラーポップアップが表示されます