在已加载的jquery页面中加载页面!

时间:2011-03-26 14:17:53

标签: jquery

我想知道是否可以使用jquery从已加载的页面加载第二页,

我已经完成了加载第一页,在这种情况下它是一个画廊我可以加载我想要的所有图像现在我想要的是点击它们和一个将显示图像细节的弹出窗口,我有弹出窗口的脚本也是如此,但是当我将弹出窗口与加载了jquery的图库组合时,弹出窗口不起作用。

<a href="detail.php?iid='.$iid.'" class="ajax"><img name="" style="margin:2px;" src="image.php?width=100&height=100&cropratio=2:2&amp;image=/u/'.$file.'"  alt="" /></a>


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>



<script type="text/javascript">
$(function (){
    $('a.ajax').click(function() {
        var url = this.href;
        var dialog = $('<div style="display:hidden"></div>').appendTo('body');
        // load remote content
        dialog.load(
            url, 
            {},
            function (responseText, textStatus, XMLHttpRequest) {
                dialog.dialog();
            }
        );
        //prevent the browser to follow the link
        return false;
    });
});
</script>

因为你可以看到detail.php通过url属性获取imageid,当我使用它直接gallery.php时这个剂量工作,问题只有在我使用jquery加载gallery.php虽然index.php时才会出现。

这是使用index.php文件加载gallery.php的脚本..

$(document).ready(function()
        {
            $("#gl").click(function()
            {
                //$(this).text("...One Moment Please...");
                $("#container").append('<div id="glr" "></div>')
                .children("#glr").hide()
                .load("gallery.php div#glr", function()
                {
                $("#tet").remove();
                $("#rem").remove();
                $("#glr").slideDown("slow");
                });
                return false;
            });
        }); 
你可以在下面的照片中看到,当我直接去gallery.php时,它有效。

http://i.stack.imgur.com/Gyf4A.png

这是在使用jquery通过index.php加载时的gallery.php。

http://i.stack.imgur.com/oqVce.png

当我加载gallery.php ..

时,我不会弹出pop detail.php

任何反馈都将不胜感激,

THANKYOU M.Amin

1 个答案:

答案 0 :(得分:0)

尝试使用.live()jquery api这里是文档http://api.jquery.com/live/