【问题标题】:jQuery ajax load event not workingjQuery ajax 加载事件不起作用
【发布时间】:2012-06-11 16:55:06
【问题描述】:

我正在尝试使用 jQuery 的 ajax 加载事件将网站的另一部分加载到 div 中。长话短说——它没有加载任何东西。我尝试过使用带有点击事件的链接(出于测试目的)。

这里是 jQuery 代码:

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    $(document).ready(function(){
        <script type="text/javascript">
            $('#content-load-ajax').load('http://http://chemswap.com/register.php');
        </script>
    });

我正在尝试将 registrar.php 放入 div ID content-load-ajax。页面加载时无法加载php页面。

更多信息: *URL:http://www.chemswap.com/wordpress/registrar/(正在加载的页面在 iFrame 中)

*我在 WordPress 上运行它。

*registrar.php 是为客户旧站点开发的定制软件。它引用了许多不同的模块等。我们只想将 registrar.php 直接加载到当前页面中。

如果有人知道为什么这不起作用,请告诉我。

【问题讨论】:

    标签: jquery jquery-load


    【解决方案1】:

    $(document).ready() ... 也是 Javascript,因此您也需要在其周围加上 &lt;script&gt; 标记。

    <script type="text/javascript">
        $(document).ready(function(){
            $('#content-load-ajax').load('http://http://chemswap.com/register.php');
        });
    </script>
    

    【讨论】:

    • 我这样做了,但它仍然没有加载内容。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    相关资源
    最近更新 更多