I want to delete some nodes or add some nodes in xml with jquery,
I try it with append
, empty
, remove
but all of them seem to not work,
like (in $.ajax):
success:function(xml){
$(xml).find("layout").append('<app id="' + $children.eq(i).attr("id") + '"></app>');
$(xml).find("layout").empty();
}
also I find there is no tutorial on google. So I wonder is it possible add or delete nodes in xml with jquery?
OK ,I write it in details,the xml file just save in local domain as Database/UserConfig/config.xml here is my Ajax code:
function layout_change()
{
var $children=$input.children();
$.ajax({
type: "get",
url: "Database/UserConfig/config.xml",
dataType: "xml",
timeout: 2000,
beforesend:function(xml){
$(xml).find("layout").empty();
},
success:function(xml){
for(var i=0;i<$children.length;i++)
{
$(xml).find("layout").append('<app id="' + $children.eq(i).attr("id") + '"></app>');
}
},
error:function(){}
});
}
or it can be done with javascript?or can be only done with server language like C#?……
here is my demo xml:
<layout>
<app id="id-4"></app>
<app id="id-5"></app>
<app id="id-6"></app>
<app id="id-1"></app>
<app id="id-2"></app>
<app id="id-3"></app>
</layout>