I have a 5-digit number, like 10000
, and I want to display it as 10k
, as I'll eventually have 6 digits (I'm talking about Twitter counts, actually). I suppose I have to substring, but I'm not that used to JavaScript just yet.
Here's just about what I'm trying to use. It basically gets the count of the followers by JSON.
<script type="text/javascript">
$(function() {
$.ajax({
url: 'http://api.twitter.com/1/users/show.json',
data: {
screen_name: 'lolsomuchcom'
},
dataType: 'jsonp',
success: function(data) {
$('#followers').html(data.followers_count);
}
});
});
</script>