TSCAmerica.com
TSCAmerica.com

Reputation: 5417

Read XML using Jquery

My XML Feed looks like this

http://tinyurl.com/6wc6fel

Not sure how to read the data using JQuery and show it in HTML ?

I tried to search on Google but no great results found as you can see in my XML there are many many elements

Upvotes: 0

Views: 1174

Answers (2)

SG 86
SG 86

Reputation: 7078

You could use the JParse Plugin

http://jparse.kylerush.net/demo

Upvotes: 0

Giorgio Minardi
Giorgio Minardi

Reputation: 2775

Is there a particular reason why you need then to convert it in JSON ? you can do it by first parsing the xml data you retrieve and then create the json using JSON.stringify

Here's how to retrieve the xml, you can use either the $.ajax or the $.get methods :

<script type="text/javascript">
    $(document).ready(function () {

//YOU CAN USE THIS

        $.get("yourfile.xml", function (data) {            
            alert('Load was performed.');
        });

//OR THIS

        $.ajax({
            type: "GET",
            url: "yourfile.xml",
            dataType: "xml",
            success: function (xml) {
                alert('Load was performed.');
            }
        });

    });

 </script>

Upvotes: 1

Related Questions