【问题标题】:Wordpress get content from another page and append it to active page with jQueryWordpress 从另一个页面获取内容并使用 jQuery 将其附加到活动页面
【发布时间】:2017-07-09 11:29:55
【问题描述】:

我试图通过附加内容在 wordpress 中创建无限滚动(似乎很简单)

但唯一被附加的是 “http://localhost/wptest/test2/#内容”

我读了很多,但理解不够,无法解决问题对不起:(。

有人会这么好心地把我推向正确的方向吗?

<script>
  jQuery(document).ready(function() {
  alert( "test 1" );
  jQuery("#content").append("http://localhost/wptest/test2/ #content");
  alert( "test 2" );
  });
</script>

【问题讨论】:

    标签: jquery wordpress append infinite-scroll


    【解决方案1】:

    我终于明白了^^, 它实际上很简单:像这样使用 jQuery get 函数(对于正在搜索的每个人):

    <script>
    jQuery(document).ready(function() {
        jQuery.get("http://localhost/wptest/test2/").success(function(data){
            jQuery(data).find('#content').appendTo('#content');
        });
    });
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-01
      • 2012-01-23
      • 1970-01-01
      • 2021-02-14
      • 2022-01-09
      • 1970-01-01
      相关资源
      最近更新 更多