Ajax 分页 wordpress

Ajax pagination wordpress

我在 wordpress 上的 ajax 分页有问题:

$(function($) {   
    // When i click on pagination link  
    $('.last-news').on('click', '.pagination a', function(e){
        // I remove the default behavior
        e.preventDefault();

        // Then i add a smoothscroll to the top
        var scrollPosition = $(window).scrollTop(),
            $content = $('.last-news .content');
        $('html, body').stop().animate({
            scrollTop:$("#last-news").offset().top   
        }, 400); 

        // There is the ajax code where i get the content of my link
        var link = $(this).attr('href');
        // I fadeOut the content before i fadeIn the new one
        $content.fadeOut(200, function(){
            // I call the content of my link
            $content.load(link + '.last-news .content', function() {
                $content.fadeIn(200);
                // I change the url without refreshing the page
                history.pushState(null, null, link);
            });
        });
    });
});

我该如何调试它? (我对 ajax :s 不够熟悉)。

你知道我可以尝试修复它吗?

感谢您的宝贵时间

好的,我修好了!

因为我的 url 是正确的,所以我必须在 任何代码 之前将服务器响应的 header 更改为 header("HTTP/1.1 200 OK"); header.php 文件

我真的不知道当我开始生产时是否需要删除它,或者这是否会产生其他问题,但现在它已经完全正常工作了。希望我可以避免其他人在这上面浪费时间:)