0

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>

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

4

1 回答 1

3

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

$("div").load(this.href, function(){
   alert("shod");
});
于 2013-05-23T22:10:47.730 回答