Mahdi_Nine
Mahdi_Nine

Reputation: 14761

why jquery.load function not working?

in dbload.php i wrote:

    <?php

    class grid
    {

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

        }
    }
?>

and in load.php i wrote:

<!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>

but my load function not working. any idea?

Upvotes: 0

Views: 77

Answers (1)

Ram
Ram

Reputation: 144739

You should pass a string for the url argument instead of an object:

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

Upvotes: 3

Related Questions