title: Read XML file with jQuery
body: <p>I have an xml file in the form:</p>
  
  <pre><code>&lt;cart&gt;
  &lt;itemCount&gt;1&lt;/itemCount&gt;
  &lt;cartTotal&gt;33.94&lt;/cartTotal&gt;
  &lt;/cart&gt;
  </code></pre>
  
  <p>This is to track what is in the contents of an ecommerce shopping cart. So it will always only have one "cart" node.</p>
  
  <p>I want to read the "cartTotal" field. If it is greater than 0, then I want to display my "View cart" button on the website.</p>
  
  <p>I've tried the following and it isn't working:</p>
  
  <pre><code>$(document).ready(function(){
      $.ajax({
          type: "GET",
          url: "https://www.example.com/file.xml",
          dataType: "xml",
          success: function(xml) {
              $(xml).find('cart').each(function(){
                  if (($(this).attr('cartTotal')) &gt; 0) {
                      $("a.view-cart-button").css('visibility', 'visible');
                  }
              });
          }
      });
  });
  </code></pre>