如何将 xml 文件内容加载到 div。
这是我需要在其中加载 XML 内容的 HTML
<div class="editorial" id="news-container">
</div>
XML 数据
<contentprogramming>
<category name = "My t" id = "1">
<logo>http://123.png</logo>
<channel name="res" id= "1" type="ecommerce">
<logo>http://11.png</logo>
<items>
<item id="1">
<image>http://11.jpg</image>
<title>Memory Card MSMT2G</title>
<details>$6.99</details>
<linkurl>http://www.test.com/Sony</linkurl>
</item>
<item id="2">
<image>http://i2.jpg</image>
<title>Apple iPad </title>
<details>$579.95</details>
<linkurl>http://www.test.com/Apple</linkurl>
</item>
</items>
</channel>
</category>
</contentprogramming>
而xml文件名是something.xml
我尝试了几种方法,但没有奏效:(
我尝试了以下方法,但没有奏效。
$('something.xml').find('name').each(function() {
$("#news-container").append($(this).text() + "<br />");
});