XML
<?xml version='1.0' encoding='utf-8' ?>
<RecentTutorials>
<Tutorial author='The Reddest'>
<Title>Silverlight and the Netflix API</Title>
<Categories>
<Category>Tutorials</Category>
<Category>Silverlight 2.0</Category>
<Category>Silverlight</Category>
<Category>C#</Category>
<Category>XAML</Category>
</Categories>
<Date>1/13/2009</Date>
</Tutorial>
</RecentTutorials>
Run Code Online (Sandbox Code Playgroud)
脚本
$.ajax({
type: "post",
url: "Default.aspx?cmd=Setting",
success: parseXml
});
Run Code Online (Sandbox Code Playgroud)
alert(xml);//show xml File Success
$(xml).find("Tutorial").each(function()
{
$("#b").append($(this).attr("author") );
}
没有读取的XML文件虽然是alert(xml); 显示XML文件