Learn, Share, Build

218
October 06, 2017, at 10:38 PM

I have a problem with this code.

$(window).scroll(function(){ 
        var position = $(window).scrollTop(), bottom = $(document).height() - $(window).height(); 
 
        if (position == bottom) { 
            var row_tracks = $('#row_tracks').html(), allcount = $('#count_tracks').html(), rowperpage = 10; 
            row_tracks = parseInt(row_tracks) + rowperpage; 
 
            console.log(row_tracks); 
 
            if ($(".list-songs")[0] && row_tracks <= allcount) { 
                $('#row_tracks').html(row_tracks); 
 
                $.ajax({ 
                    url: 'ajax.php', 
                    type: 'post', 
                    data: {row_tracks: row_tracks}, 
                    success: function(response){ 
                        $('.list-songs').append(response); 
                    } 
                }); 
            } 
        } 
    }); 

When I make the ajax request, row_tracks doesn't increment...

If i comment the ajax call then it increment...

Thank you for your help.

  • FirstPrizePies
READ ALSO
Learn, Share, Build

Learn, Share, Build

I am trying to create a typescript definition file for a javascript for use in a desktop applicationI am interested in the intellisense feature of typescript

130
Learn, Share, Build

Learn, Share, Build

For some reason I can't scroll on a website that I am working onEventhough u see the scrollbar and u can drag it up and down

184
Learn, Share, Build

Learn, Share, Build

So i've got a dataset with movie ratings, each movie got multiple ratingsI managed to get all the data but i want to add all the values

178