Javascript 在“我的网页”的某个部分中动态打开完整日历

Javascript 在“我的网页”的某个部分中动态打开完整日历,javascript,php,html,fullcalendar,Javascript,Php,Html,Fullcalendar,我希望在这里找到解决办法 我有一个PHP页面(calendar.PHP),可以正常工作(我使用Fullcalendar)。当我打电话时http://localhost/calendar.php 一切正常 我有一个主页(index.php),有一个导航、一个节和一个页脚 在index.php中,我想使用JS将calendar.php页面打开到中(参见下面的代码)。 当我打电话时http://localhost/index.php 我点击项目菜单“Accueil”,Js调用页面(calendar.p

我希望在这里找到解决办法

我有一个PHP页面(calendar.PHP),可以正常工作(我使用Fullcalendar)。当我打电话时http://localhost/calendar.php 一切正常

我有一个主页(index.php),有一个导航、一个节和一个页脚

在index.php中,我想使用JS将calendar.php页面打开到中(参见下面的代码)。 当我打电话时http://localhost/index.php 我点击项目菜单“Accueil”,Js调用页面(calendar.php),但ID部分没有显示任何内容,控制台中也没有错误

如果我更改链接以打开另一个HTML测试页面(例如test.HTML),它就会工作。如果我使用其他php测试页面(例如test.php),它也可以工作

我不知道为什么日历页面(calendar.php)没有在我的部分打开

这是index.php代码:

    <title>Test</title>
     <link href='<?=$dir;?>style.css' rel='stylesheet' />
     <script src='<?=$dir;?>packages/jquery/jquery.js'></script>    
     <script src='<?=$dir;?>main.js'></script>

    <header>
        <h1>Test</h1>
        <h2>Carnets de voyage</h2>
    </header>
    <nav>
        <ul id="menu">
            <li><a href="./calendar.php" id="Zmenu1">Accueil</a></li>
            <!-- <li><a href="<?=$dir;?>calendar/index.php" id="Zmenu1">Accueil</a></li> -->
            <li><a href="#">Blog</a></li>
            <li><a href="#">CV</a></li>
        </ul>
    </nav>
    <section>
        <div id="content">
            <h1>Accueil</h1>

            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
    </section>
有人能帮我理解为什么calendar.php页面没有出现吗

非常感谢


(很抱歉我的英语不好)。

欢迎来到Stack Overflow!我们还需要查看calendar.php的代码。这是calendar.php代码的示例源代码:如果使用
.load
(或任何其他AJAX函数)加载包含Javascript
块的内容,通常不会执行Javascript。一般来说,这是一种安全特性。因此加载日历的脚本将不会被执行。为什么在代码中有两次
jQuery(document).ready
?Adyson,我的代码中只有1个jQuery(document).ready。复制/粘贴时出错。
 jQuery(document).ready(function(){
   var url = $(this).attr('href')

   jQuery(document).ready(function(){ 
     $('#menu li a').click(function(event){
       var url = $(this).attr('href');
       $('#content').load(url + "#content");
       //$('#content').load("/calendar/index.php");
       event.preventDefault();
     });
   });