title: Parse XML in jQuery by passing an id
body: <p>I have 4 blocks of xml, that I want to parse whith jQuery making one ajax call. Now four blocks of xml are different from each other(But the structure is same). I am trying to parse this xml by passing an id to each of the xml block, But in my ajax call I am not able to retreive the id attribute as it is the first thing that I need to capture to pass to the ajax function. </p>
  
  <p>I tried something like this:</p>
  
  <p>XML is here:</p>
  
  <pre><code>       &lt;dropdown&gt;
              &lt;test id="1"&gt;
              &lt;optionheading&gt;
                  &lt;heads&gt;Heading 1&lt;/heads&gt;
                              &lt;value&gt;
                                      &lt;values images='images/1.gif'&gt;Option1&lt;/values&gt;
                                      &lt;values images='images/2.gif'&gt;Option2&lt;/values&gt;
                                      &lt;values images='images/3.gif'&gt;Option3&lt;/values&gt;
                              &lt;/value&gt;
              &lt;/optionheading&gt;
      .....................................
  
      ............................
      &lt;/test&gt;
      &lt;test id='2"&gt;
      &lt;optionheading&gt;
                  &lt;heads id="b"&gt;H..................
      ..................
      ............
      &lt;/test&gt;
  &lt;/dropdown&gt;
  </code></pre>
  
  <p>I need to get id of test1, test2, et-al</p>
  
  <p>Ajax is Here:</p>
  
  <pre><code>$("document").ready(function() {
                  $.ajax({ 
                      type: "GET",
                      url:"dropdown.xml",
                      dataType: "xml",
                      success :function(xml) {
                          var select = $("#mySelect"); 
                          //I am getting id here
                          var id=$(xml).find('test').attr('id'); 
  
                          $(xml).find('test'+id).each(function() {
                              $(this).find('optionheading').each(function() {
                              var opthead = $(this).fin......................
  </code></pre>