Skip to content

problem using the play function #6

@kchiang

Description

@kchiang

Getting a undefined object error when using ajax to update the counter variables and "replaying" the counter.

&ltspan class="total_stats counter counter-analog" data-direction="up" data-format="999,999" datastop="150,000" data-interval="1"&gt145,000&lt/span&gt
&ltscript&gt
$('.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');
});
});
&lt/script&gt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions