如何使用Ajax在HTML页面上显示XML文件?

时间:2015-05-26 23:21:11

标签: javascript jquery html ajax

据说!!我需要展示这些东西

<products>

        <product category="Clothes" title= "Rock Paper Scissors Lizard Spock" price="19.99" film="The Big Bang Theory" id="1">
            <description>THROW DOWN
For folks too lazy to break out Urban Spoon when deciding on lunch, we offer a superior alternative to Rock Paper Scissors. And if you wear this shirt while making the decision, you can always remember what beats what because we've provided handy arrows.</description>
            <stock>5</stock>
            <imagesource>images/series/tbbt/products/rpss.jpg</imagesource>
        </product>

        <product category="Merchandise" title= "Periodic Table Shower Curtain" price="29.99" film="The Big Bang Theory" id="2">
            <description>
                CLEANLINESS IS NEXT TO AMERICIUM
Shower curtain features Periodic Table of Elements
71 inches of inspiring, beautiful chemistry
Semi-transparent with colorful blocks
            </description>
            <stock>6</stock>
            <imagesource>images/series/tbbt/products/curtain.jpg</imagesource>
        </product>
</products>

在我的html页面上使用ajax

1 个答案:

答案 0 :(得分:0)

this post将所有xml包装在文本区域标记

<textarea style="border:none;">..XML Here..</textarea>

这没有边框,textarea不会将xml视为纯文本标记。