1

我有一个问题,我相信它与我的 ajax 有关,因此是标题。
我有一个脚本:

while($row = mysql_fetch_array($results)){
        $file="imgs/uploads/slideshow/".$row['image_location'];

        if(file_exists($_SERVER['DOCUMENT_ROOT'].$file)){
            $location = $file;//"imgs/uploads/thumbs/".$row['image_location'];
        } else if(!file_exists($_SERVER['DOCUMENT_ROOT'].$file)){
            $location = "imgs/resize.php?file=uploads/".$row['image_location']."&preset=slideshow";
        }
        $lightboxUrl = "imgs/resize.php?file=uploads/".$row['image_location']."&preset=lightbox2";
        $date = $index->formatDate($row['image_upload']);
        $name = $row['image_name'];
        print<<<HERE
            <div>
                <a href='$lightboxUrl' class='lightbox'>
                    <img title='$date' src='$location'/>
                </a>
            </div>";
HERE;
}

在 ajax 加载的选项卡(jquery ui)内打印。它适用于除第一个图像之外的所有图像。第一个调用的图像有一个请求 url,如下所示:
http://localhost/site/imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&preset=slideshow?1337224225894 看到?1337224225894最后了吗?
这就是搞砸了。
添加到 url 中的位会使请求 url 无效,并且参数不会传递给脚本,因此我?得到的是完整图像而不是重新调整大小的图像。

所有其他网址都是正确的。我什至可以在脚本中回显该 url,它是正确的,但是当它被调用时,它会变得一团糟。我有一个模糊的想法,这是由于我的选项卡实例中没有使用缓存参数引起的,但它没有意义,因为它曾经工作过。
任何想法?

编辑:奇怪的是,当由普通的 ajax 请求与选项卡交易调用时,相同的脚本似乎可以完美地工作,至少这是我能看到的脚本之间的唯一区别。

EDIT2:
请求的标签初始化脚本:

 $(function(){
        $('#slides').slides({
            preload: true,
            generateNextPrev: false,
            preloadImage: 'imgs/loading.gif',
            //bigTarget: true,
            play: 5000,
            slideSpeed: 3000,
            generatePagination: false


        });
    });

这是视图源给出的标记:

<div id="content">

        <div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
                <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#ui-tabs-1" id="public">Public View</a></li>
                <li class="ui-state-default ui-corner-top"><a href="#settings">Settings</a></li>
                <li class="ui-state-default ui-corner-top" id="editLink"><a href="#ui-tabs-2" id="edit">Edit Blog</a></li>
                <li class="ui-state-default ui-corner-top"><a href="#profile" "="">Profile</a></li>
            </ul><div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="ui-tabs-1">                      
            <div id="slides">
                    <div style="overflow: hidden; position: relative; display: block;" class="slides_container">                <div style="position: relative; width: 1800px; height: 600px; left: -600px;" class="slides_control"><div style="position: absolute; top: 0px; left: 600px; z-index: 5; display: block;">
             imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 20:09" src="imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow?1337226056936">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371236426r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371236426r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:14" src="imgs/resize.php?file=uploads/113371236426r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:10" src="imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:08" src="imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:07" src="imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:04" src="imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 19:01" src="imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 14:37" src="imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&amp;preset=slideshow">
                </a>
            </div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
             imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&amp;preset=slideshow
                <a href="imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&amp;preset=lightbox2" class="lightbox">
                    <img title="Yesterday @ 14:36" src="imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&amp;preset=slideshow">
                </a>
            </div></div>";                                      </div> <!-- End # slide_container -->

                    <a href="#" class="prev"><img src="imgs/arrow-prev.png" alt="Arrow Prev" height="43" width="24"></a>
                    <a href="#" class="next"><img src="imgs/arrow-next.png" alt="Arrow Next" height="43" width="24"></a>
            </div> <!-- End # slides --></div>

EDIT3:
新的奇怪发现。使用萤火虫我发现了以下内容。正确发送标头接收到正确的数据,并且根据萤火虫源代码是正确的,但如果我得到 web dev 插件生成的源代码,它会显示额外的字符串。所以它介于接收数据和打印数据之间。我认为....

无论第一张图像是什么,都会发生这种情况,它绝不会连接到我用不同位置和文件测试过的图像或文件位置。

4

1 回答 1

0

"profile" li 中的 "="" 会有点混乱!如果你纠正了会发生什么?

a 链接因此而混乱,因此您对整个 a 元素都有麻烦!


编辑:上面的代码是您从“查看源代码”还是从 Firebug 获得的?这 ?清楚地显示在图像 URL src 中,这就是传递给灯箱的内容(不是 a href)

因此,如果“查看源”然后检查创建源的内容,因为那是添加?少量。如果来自 Firebug,我们将需要更多代码来查找 src 可以被 Javascript 修改的位置。

于 2012-05-17T04:32:34.897 回答