Donald T
Donald T

Reputation: 10647

Why doesn't this simple jQuery ajax work?

Why doesn't this simply jQuery ajax code not load pull.php into the div with id of #alert?

...
    <script src="jquery.js"></script>
    <script>
        $(document).ready(function() {
            $(".pull_button").click(function() {
                $("#alert").load("pull.php");
            });
        });
    </script>
</head>
<body>
    <div id="#alert"></div>
    <nav>
        <a class="pull_button">Pull Data</a>
    </nav>
...

Upvotes: 0

Views: 130

Answers (1)

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124768

Take the # out of <div id="#alert">.

<div id="alert">     -> $('#alert')
<div class="alert">  -> $('.alert')

Upvotes: 5

Related Questions