parseInt html string value
<p>Im trying to perform simple calculations using jQuery but I'm getting NaN as result.</p>

<p>Here is my javascript:</p>

<pre><code>$(document).on('click','.button-group button:not(.done)', function(e){
        e.preventDefault();
        $(this).addClass('active');
        var votevalue = $(this).data('votevalue');
        var image_id = $('.mainimage').data('image_id');
        var votes = $('.mainimage').data('numvotes');
        var totalscore = $('.mainimage').data('totalscore');
            $.ajax({
                type: 'POST',
                url: '?a=vote',
                data: {
                    "votevalue" : votevalue,
                    "image_id" : image_id
                },
                success: function(){
                    var votes = parseInt(votes);
                    votes++;
                    var average = ((parseInt(totalscore) + parseInt(votevalue)) / votes);
                    $('#vote-incremenet').html(votes);
                    $('#display-average').html(average);
                    $('#display-average').show();
                    $('.button-group button').addClass('done');
                }
        }); // end ajax
}); // end click
</code></pre>

<p>What am I doing wrong?</p>
