我有一个问题,我相信它与我的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中的?
on会使请求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&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 20:09" src="imgs/resize.php?file=uploads/113371269676r84gq9re1vppfram0a7ajgo15.JPG&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&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371236426r84gq9re1vppfram0a7ajgo15.jpg&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:14" src="imgs/resize.php?file=uploads/113371236426r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:10" src="imgs/resize.php?file=uploads/113371234386r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:08" src="imgs/resize.php?file=uploads/113371233356r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:07" src="imgs/resize.php?file=uploads/113371232486r84gq9re1vppfram0a7ajgo15.jpg&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:04" src="imgs/resize.php?file=uploads/113371230636r84gq9re1vppfram0a7ajgo15.JPG&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&preset=slideshow
<a href="imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 19:01" src="imgs/resize.php?file=uploads/113371228826r84gq9re1vppfram0a7ajgo15.JPG&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&preset=slideshow
<a href="imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 14:37" src="imgs/resize.php?file=uploads/11337107020jcemicq53t6g1h7m7kbfre77i1.JPG&preset=slideshow">
</a>
</div><div style="position: absolute; top: 0px; left: 600px; z-index: 0; display: none;">
imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&preset=slideshow
<a href="imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&preset=lightbox2" class="lightbox">
<img title="Yesterday @ 14:36" src="imgs/resize.php?file=uploads/11337106997jcemicq53t6g1h7m7kbfre77i1.jpg&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:
新奇怪的发现。使用firebug我发现了以下内容。头文件正确发送,收到正确的数据,并根据firebug源代码是正确的,但如果我得到web dev插件生成源它显示额外的字符串。所以它介于接收数据和打印数据之间。我想......
无论第一张图像是什么,它都无法连接到我用不同位置和文件测试过的图像或文件位置。
答案 0 :(得分:0)
“个人资料”中的“=”“会使事情变得混乱!如果你纠正了会怎样?
a链接因为它而搞砸了,因此你对整个元素都有麻烦!
编辑:上面的代码是从“查看源”或Firebug获得的吗?的?清楚地显示在图像URL src中,这是传递给灯箱的内容(而不是a href)
因此,如果“查看源代码”然后检查创建源的内容,那么添加?位。如果来自Firebug,我们需要更多代码来查找Javascript可以修改src的位置。