JQuery和PHP下的Pb:使用GET传递arg以显示内容细节

JQuery和PHP下的Pb:使用GET传递arg以显示内容细节,php,jquery,Php,Jquery,我想在侧边栏中查看内容列表。 当我点击这个侧边栏中的一个特定内容时,应该会用它的信息刷新内容细节 2页:test_content.php和test_content_detail.php <?php /* $Id: test_content.php $ Show all content */ ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" con

我想在侧边栏中查看内容列表。 当我点击这个侧边栏中的一个特定内容时,应该会用它的信息刷新内容细节

2页:test_content.php和test_content_detail.php

<?php
/*
  $Id:  test_content.php $
  Show all content
*/
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    
    <script type="text/javascript" charset="UTF-8" src="./js/jquery.min.js" ></script>
    <script type="text/javascript">
        function loadContent(id) {
            var $element = $('#content');
            var $response = $element.load("test_content_detail.php?id="+id+" #content_detail");
        };
    </script>
</head>
<body>
<div id="main">
    <div id="sidebar">
        <div id="items">
            <div id="1" class="item">  
                    <input type="button" value="Should show 1" onClick="loadContent(1);">
            </div>
            <div id="2" class="item">  
                    <input type="button" value="Should show 2" onClick="loadContent(2);">
            </div>
            <div id="3" class="item">  
                    <input type="button" value="Should show 3" onClick="loadContent(3);">
            </div>
        </div>
    </div>
    <div id="content">
        <div id="content_detail">
            empty
        </div>
    </div> 
</div>
</body>
</html>
jquery调用:

<?php
/*
  $Id:  Test_content_detail.php $
  Show one content
*/
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    
    <script type="text/javascript" charset="UTF-8" src="./js/jquery.min.js" ></script>
    <script type="text/javascript">
        function fillDetail(){
             var html = '<br>My detail : ';
             var id = "<?php print $_GET['id']?>"; // Where the PHP do the job
             if (id){
                     html += "my id = "+id;
              }
              var $detail = $('#content_detail');
              $detail.append(html);
        };

        $(document).ready(fillDetail);
    </script>
</head>
<body>
<div id="main">
    <div id="sidebar">
        none
    </div>
    <div id="content">
        <div id="content_detail">
            supposed to be filled with <?php print $_GET['id']?>
        </div>
    </div> 
</div>
</body>
</html>
*Test\u content\u detail.php?id=3*正确。 但是当我点击3时,我看到的应该是3,没有细节

序列pb? 提前谢谢

朋友的回复:AJAX调用中没有Javascript

$element.loadtest\u content\u detail.php无法启动$document.readyfillDetail

解决方案:在同一个内容文件中包含所有js。

是test\u content\u detail.php还是test\u content\u detail.php?什么是Pb?Pb是当我启动test_content.php时,当我点击click 3时。我在等待我的详细信息:我的id=3。但我不知道为什么fillDetail函数不能完成这项工作?