jquery-counter
jquery-counter copied to clipboard
problem using the play function
trafficstars
Getting a undefined object error when using ajax to update the counter variables and "replaying" the counter.
<span class="total_stats counter counter-analog" data-direction="up" data-format="999,999" datastop="150,000" data-interval="1">145,000</span> <script> $('.counter').counter({}); $('.counter').on('counterStop',function() { $.ajax( { url: 'get_counter_stats.php', cache:false,success:function(html){ $('.counter').replaceWith(html);} }).done(function() { $('.counter').counter('play'); }); }); </script>
Here's the error: play: function() { return this.each(function() { var e = $(this); var data = e.data('counter'); if (!data.intervalId) {
UNCAUGHT type error: cannot read property 'intervalId' of undefined
var data in this case is undefined.