jQuery ajax加载事件无法正常工作

时间:2012-06-11 16:55:07

标签: jquery jquery-load

我试图使用jQuery的ajax的load事件将站点的另一部分加载到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页面。

更多信息: *网址:http://www.chemswap.com/wordpress/registrar/(其中加载的页面位于iFrame中)

*我在WordPress上运行它。

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

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

1 个答案:

答案 0 :(得分:1)

$(document).ready() ... 也是 Javascript,因此您需要将<script>标记放在其周围。

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