title: Ajaxify header cart items count in Woocommerce
body: <p>I'm creating a custom woocommerce integrated theme for wordpress.</p>
  
  <p>I have a blob on the top that displays the total number of items in the cart, I want to update this blob using Jquery (w/o reloading the page) I was able to increase the number of items by getting the current number in the blob and increasing it by +1 for each click, the problem is the add to cart has an option to select the number of items you want to add to the cart. So if I select 3 items and click the button the blob only increases by one.</p>
  
  <p>I can create a way to get the number of items being added from the front-end but I think it's unnecessary. I want to be able to get the total number from PHP sessions using jquery so that on every click of add item or remove item I'll get the current number dynamically from the server.</p>
  
  <p>What I have done so far is to create a reloadCart.php file that echos the cart total, here's the code</p>
  
  <pre><code>&lt;?php
  require('../../../wp-blog-header.php');
  global $woocommerce;
  echo $woocommerce-&gt;cart-&gt;get_cart_contents_count();
  ?&gt;
  </code></pre>
  
  <p>When I visit this page it echos the current item totals, but I cant get this data from jquery, it's been sometime since I last used AJAX also I have not worked on web projects for a very long time, but with what I remember, the AJAX call that I'm making is right.</p>
  
  <p>I have tried using the get() and post() functions of jquery as well as the normal ajax() function, but nothing seems to work. Can someone please help?</p>
  
  <pre><code>$(".ajax_add_to_cart").click(function () {
     /*$("#bag-total").html(function () {
          var bagTotal = parseInt($(this).html());
          return ++bagTotal;
      });*/
      alert('clicked');
      $.get("&lt;?php echo get_template_directory_uri(); ?&gt;/reloadCart.php", function(data){
          alert("Data: " + data);
      });
  }); 
  </code></pre>
  
  <p>The lines that are commented are the ones that I was using previously, to add the cart total by getting the current cart number from the front-end.</p>
  
  <p>Any help would be appreciated. Thanks in advance!</p>