Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ajax调用后不解释Javascript_Javascript_Wordpress - Fatal编程技术网

ajax调用后不解释Javascript

ajax调用后不解释Javascript,javascript,wordpress,Javascript,Wordpress,我正在制作一个wordpress网站,我遇到了一个问题。我在几个社交网站上添加了一个分享帖子的社交按钮 我还做了一个无限滚动加载下一篇文章。我的问题是,当我将html回调放入我的页面时,这个javascript没有被解释。这个按钮是用javascript制作的 我的ajax调用返回wordpress页面的所有html(带有html标记…) 以下是我的javascript代码: $(window).scroll(function(){ if ($(window).scrollTo

我正在制作一个wordpress网站,我遇到了一个问题。我在几个社交网站上添加了一个分享帖子的社交按钮

我还做了一个无限滚动加载下一篇文章。我的问题是,当我将html回调放入我的页面时,这个javascript没有被解释。这个按钮是用javascript制作的

我的ajax调用返回wordpress页面的所有html(带有html标记…)

以下是我的javascript代码:

$(window).scroll(function(){
        if  ($(window).scrollTop() == $(document).height() - $(window).height()){

            // Are there more posts to load?
            if(pageNum <= max) {
                $.ajax({
                    type: "GET",
                    url:nextLink,
                    dataType: "html",
                    success : function(data) {
                        // Update page number and nextLink.
                        pageNum++;
                        nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);
                        var pageN = pageNum-1;
                        var div = $(data).find('.my-post-format');

                        // Add a new placeholder, for when user clicks again.
                        $('#pbd-alp-load-posts')
                            .before('<div class="pbd-alp-placeholder-'+ pageNum +'"></div>')
                    }


                });
            }
        }
    });
$(窗口)。滚动(函数(){
if($(窗口).scrollTop()==$(文档).height()-$(窗口).height()){
//还有更多的帖子要加载吗?
如果(pageNum

尝试创建一个包含div并向其中添加数据,如$('').html(数据)

$('<div />').html(data) $('<div />').html(data)