简体   繁体   English

为什么这个简单的jQuery ajax无法正常工作?

[英]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 ? 为什么这个简单的jQuery ajax代码没有将pull.php加载到id#alertdiv中?

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

Take the # out of <div id="#alert"> . 就拿#出来的<div id="#alert">

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM