douqiao2008 2013-12-24 06:40
浏览 65

仅在div中加载php内容

I have gone through this Link here at stackoverflow, but I cant seem to get the div loaded here is my code

<div id="leftmenu" style="font-size:20px;position:absolute;top:12%;bottom:0;right:0;left:2%;">
                <a href="#" id="details"> Form </a>
</div>

<div id="content" style="font-size:20px;position:absolute;top:12%;bottom:0;right:10%;left:12%;">
</div>

<script>
          $(document).ready(function(){
            $("#details").click(function(){
                $("#content").load('student_details.php');
            });
          });
</script>

Edit: Made change to Load part but still does not work for me

Edit 2:

<!DOCTYPE html>
<html>
    <head>
       <title> test </title> 
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
       </script>
    </head>
    <body>
        <div id="leftmenu" style="font-size:20px;position:absolute;top:12%;bottom:0;right:0;left:2%;width:100px;height:100px;">
                <a href="#" id="details"> Form </a>
        </div>

        <div id="content" style="font-size:20px;position:absolute;top:12%;bottom:0;right:10%;left:12%;">
        </div>
        <script>
          $(document).ready(function(){
            $("#details").click(function(){
                $("#content").load('load.html');
            });
          });
        </script>
    </body>
</html>

The following code also fails to work the load.html file is present in D: drive have I done something wrong in div? or maybe the script tag?

the content of load.html is " this works "

  • 写回答

2条回答 默认 最新

  • doujiao0110 2013-12-24 06:41
    关注

    The url has to be passed as an string literal enclosed within '' or ""

    $("#content").load('student_details.php');
    
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效