title: jQuery to Javascript Conversion for AJAX request
body: <p>Looking to convert a jQuery snippet to javascript. Totally hitting a wall with this.</p>
  
  <p>Are there any automated tools for doing this?</p>
  
  <p>The reason we're converting this is because the code is used as part of a product that we're planning on injecting in the future and we can't guarantee that the site has the appropriate (or any) version of jQuery running.</p>
  
  <p><em>EDIT: The reason we can't control the use of jQuery is that the customer will be copying and pasting this code themselves. It's highly likely that they will be non-technical and as such not willing/able to setup the appropriate version of jQuery</em></p>
  
  <p>This is the jQuery code we're using now:</p>
  
  <pre><code>$(function() {
      $.getJSON('http://api.seedthechange.org/get/?method=getCount&amp;str=suitjamas&amp;jsoncallback=?', function(data) {
            treecount = csn(data[0]); 
            $('span.SeedTheChangeCount').text(treecount); 
        });
  })
  
  function csn(val){
      // convert int to comma separated number (1000 -&gt; 1,000)
      while (/(\d+)(\d{3})/.test(val.toString())){
          val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
      }
      return val;
  }
  </code></pre>
  
  <p><strong>Thanks in advance for any help or tips.</strong></p>