I have tried using .on method which gives the same outcome and have tried using document.ready which also doesn't effect it.
$(document).ready(function() {
$("#addToCart").click(function(){
jQuery.getJSON('/cart.js', function(cart) {
$("span.count").html(cart.item_count);
});
});
});
I expect the addToCart button to update the span.count on every click. The actual result is that it works after the first click.