为什么jquery.load功能不起作用?

时间:2013-05-23 22:08:13

标签: php jquery

dbload.php我写道:

    <?php

    class grid
    {

        function show()
        {
            echo"<div id = 'show'>";
            if(isset( $_GET["Name"] ))
                echo "done";
            else
                echo "Not done";
                echo "</div>";

        }
    }
?>

并在load.php我写道:

<!DOCTYPE html>
<?php
include "dbload.php";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-1.9.1.min.js"></script>
    <script>
        $(document).ready(function () {

            $("a").click(function () {


                $("div").load(this, function(){
                    alert("shod");
                 });

                return false;



            });
        });


    </script>
</head>
<body>
<a href="load.php?Name=mehdi"> click for load ajax</a>
    <?php
    $db = new grid();
    $db->show();


    ?>
</body>
</html>

但我的加载功能不起作用。任何想法?

1 个答案:

答案 0 :(得分:3)

您应该传递url参数的字符串而不是对象:

$("div").load(this.href, function(){
   alert("shod");
});