<?xml version="1.0" encoding="UTF-8"?>
<dados>
<usuarios>
<usuario>
<login>usuario</login>
<senha>senha123</senha>
</usuario>
</usuarios>
</dados>
I can easily read the user's nodes. But I can not add another user. Can someone help me? If there is any way with pure javascript also no problem. Thank you in advance!
Edit 1 : The jquery code I'm using is this:
$.ajax({
url: "../xml/dados.xml",
type: "get",
dataType: "xml",
success: function(data) {
xml = data;
var xmlDoc = $(xml);
var element = xmlDoc.filter('usuarios');
$(element).attr('type', 'vip');
$(element).append("<usuario><login>usuario2</login><senha>senha321</senha></usuario>");
$("body").append(xmlDoc);
}
});
I found this code looking in this jquery forum: link