L
L
lemonlimelike2017-03-27 00:22:56
JavaScript
lemonlimelike, 2017-03-27 00:22:56

Ajax requests why not working?

$(document).ready(function(){
var num = 20;
var inProcess = false;
$(window).scroll(function(){
if ($(window).scrollTop() + $(window).height > = $(document).height() && !inProcess ){
$.ajax({
url: 'load.php',
method: 'GET',
data: {"num" : num},
beforeSend: function(){
inProcess = true;
}
}).done(function(data){
console.log(data);



data = jquery.parseJSON(data);
if (data.legth > 0) {
$.each(data, function(index, data ){
$(".videos") .append("


  • div class="videos_image"
    a href="pagevideo/"img src="/media/images/" + data.image + " width="250" height="180" / /a
    div
    div class="videos_title"> " + data.title + "div
    div class="videos_views" p Views:" + data.views" p div
    li
    ul
    ");
    });
    inProcess = false;
    num += 10;
    }
    });
    }
    });
    });

    Help me find the mistakes please (removed ">" "<" "/" because he doesn't want to show, so that they don't say all sorts of nonsense,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Kostin, 2017-03-27
@lemonlimelike

Use a debugger to see how your code works.

$(window).scroll(function(){
    debugger;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question