$.getJSON Twitter

This example shows how to get your tweets using $.getJSON and displaying them in a unordered list

by Dmitry Maximov

HTML

<script>
</script>
<div id="el"></div>

JavaScript

// Animate the element's value from x to y:
  $({someValue: 0}).animate({someValue: 22.130}, {
      duration: 3000,
      easing:'swing', // can be anything
      step: function() { // called on every step
          // Update the element's text with rounded-up value:
          $('#el').text(commaSeparateNumber(this.someValue));
      },
      complete:function(){
          $('#el').text(commaSeparateNumber(this.someValue));
      }
  });

 function commaSeparateNumber(val){
     val = Math.round(val * 1000) / 1000;
     
    while (/(\d+)(\d{3})/.test(val.toString())){
      val = val.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
    }
    return val;
  }