![]() |
JQuery parsing xml
I'm trying to learn and understand how to use jquery to parse some xml data.
I found a nice brief tutorial Here. I believe I understand the code some and so how function finds the approprate 'site' or tag your looking for. But my xml data has a number var name="xxx" for tag names, so I'm not sure who to modify the code corrrectly. A sample of my xml looks something like: (Note, the xml data is ALOT larger than this. I only posted a small piece to show what I'm working with. Code:
<global> |
Much better tutorial:
http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html In your case you want to loop through the return XML object, using a jQuery selector. For each "var" tag you find, you can determine the value of the name attribute using the attr() function. Something like this: PHP Code:
|
Thanks for the help and other tutorial. I'm still failing at getting the information though, even after your explanation. I would have thought the below is correct, but I can't get anything to show.
PHP Code:
|
Ok, I "think" I'm learning. I figured out how to get/print/show th attributes.
I learned this from another tutorial to get the attributes PHP Code:
|
That's what this does right here:
PHP Code:
Make sure you have an element in your html (a div tag for example) with an id of "output". Without it, nothing happens. You can actually create it using jQuery: PHP Code:
|
| All times are GMT +1. The time now is 03:18 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.