title: Filter XML results on AJAX get request
body: <p>I'm new to AJAX and I'm trying to put together an example of pulling filterable information from an XML document to a webpage. So far I'm trying to create an array with these filtered XML items, then pull items from the array onto the page. </p>
  
  <p>My XML document is very simple, and all I want to do is show the items where the "type" is 100. Is it best practice to do this filtering server side or is it okay to filter during/after the request? Does anyone know why this script isn't working and/or if there's a more efficient method?</p>
  
  <p>Here is my XML:</p>
  
  <pre><code>&lt;items&gt;
      &lt;item id="1"&gt;
          &lt;type&gt;100&lt;/type&gt;
      &lt;item&gt;
      &lt;item id="2"&gt;
          &lt;type&gt;101&lt;/type&gt;
      &lt;item&gt;
      &lt;item id="3"&gt;
          &lt;type&gt;100&lt;/type&gt;
      &lt;item&gt;
      &lt;item id="4"&gt;
          &lt;type&gt;102&lt;/type&gt;
      &lt;item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>Here is my script:</p>
  
  <pre><code>$(document).ready(function(){
  
      var array = [];
  
      $.ajax({
          type: "GET",
          url: "text.xml",
          dataType: "xml",
          success: function(xml){
              $(xml).find("item").each(function(){
                  if( x == $(this).find("type") == "100"){
                      $(this).push(array);
                  }
              });   
      });
  
      $.each(array, function() {
          $(body).append("&lt;p&gt;" + $(this).attr("id") + "&lt;/p&gt;" );
      });
  });
  </code></pre>