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

Reply via email to