如何将xml文件内容加载到div。使用jquery将xml文件内容加载到div
这里是我的HTML中,我需要加载XML内容
<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
我尝试了几种方法,但它没” t工作:(
我试过下面的方法,但没有工作。
$('something.xml').find('name').each(function() {
$("#news-container").append($(this).text() + "<br />");
});
我认为这可以帮助你,'http://stackoverflow.com/questions/13534945/use-jquery-to-load-xml-file-edit-it-then-save-to-server-again-with -php' – dreamweiver 2013-05-07 10:53:49