I want to read the following XML using JQuery. The Jquery should read the XML and display the following in HTML, all the following should be linked
News
Articles
---Destinations
---Epics
Tuesday Night Bouldering
My XML Looks like below...
<category>
<catId>96</catId>
<title>News</title>
</category>
<category>
<catId>97</catId><title>Articles</title>
<category>
<catId>101</catId>
<title>Destinations</title>
</category>
<category>
<catId>102</catId>
<title>Epics</title>
</category>
</category>
<category>
<catId>129</catId>
<title>Tuesday Night Bouldering</title>
</category>
You can do this recursively.
But you need to make your xml have a root node.
here is a function for your specs (it is core jQuery so I assume the mobile version can cope with it)
and here is how to call it
demo at http://www.jsfiddle.net/gaby/UC2dM/1/
It creates a structure like this
This is the correct AJAX
JQuery gets as easy as this:
and the load XML function:
sorry, I feel I should explain - this
load_xml()
function will work crossbrowser (IE, FireFox, Chrome, Safari etc).