Here's an old, but good, tutorial on xml and jQuery: http://www.bennadel.com/blog/1054-jQuery-Demo-Working-With-XML-Documents.htm
...or if you want to make the code you have work you can "cheat" and just change the name of one of the two 'id's in your xml... ;) Wil On Wed, Nov 18, 2009 at 1:18 AM, Joe Moore <joe.lynn.mo...@gmail.com> wrote: > Instead of find, use children? > > On Nov 17, 2009 2:56 PM, "Joe" <joecel...@gmail.com> wrote: > > I have been banging my head against the wall and searching for answers > for the past week, so any help or direction would be appreciated. I > am sure that I am missing something obvious. I have some XML that > looks like this: > > <?xml version="1.0" encoding="UTF-8"?> > <customMessageList> > <CustomMessage> > <id>181</id> > <name>First Message</name> > <customMessageImage> > <id>135</id> > <name>Sample_img.png</name> > <contentType>image/png</contentType> > <modifiedOn>2009-08-25 > 11:25:28.34</modifiedOn> > </customMessageImage> > </CustomMessage> > </customMessageList> > > > And an AJAX call that looks like this: > > $.ajax({ > type: "GET", > url: myURL, > success: function(xml) { > $(xml).find('CustomMessage').each(function(){ > var id_text = (this).find('id').text(); > var name_text = $(this).find('name').text(); > var contentType_text = > $(this).find('contentType').text(); > }); //close each( > } > } > }); > > > When i run this code, the id and name variables have all the id/name > nodes in them. I only want the id/name for the child node. the > contentType variable works find (but there is only one instance. > > Any ideas on how to fix this? I am at my wits end. > > thx, > > Joe C > >