Tutorial :XML parsing Jquery



Question:

I have an XML file which has four <resultGroups> tag:

<resultGroups>       <subGroups>          <results> </results>          <results> </results>      </subGroups>      <name> </name>  </resultGroups>  

each <resultGroup> has several <subGroups> and each <subGroups> has several <result> tag.

I want to get the no of "results" tag in each subgroups, each resultGroups etc...

How can i do that using jQuery...


Solution:1

$xml = $(xmlString);  $('resultGroups', $xml).each(function() {      $('subGroups', this).each(function() {          var count = $('results', this).length;          // do whatever      });  });  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »