Load content from external page into another page using Ajax/jQuery

前端 未结 1 1449
执念已碎
执念已碎 2020-12-10 07:47

Is there a way to do this?

page1.php --has

hello

ind

1条回答
  •  抹茶落季
    2020-12-10 08:16

    Just put a filtering selector after the URL in .load's first argument:

    $(document).ready(function() {
        $("#main").load('page1.php #content');
    });
    

    That will inject the #main div in the current page with the contents of #content from page1.php.

    0 讨论(0)
提交回复
热议问题