JQTouchPhotoGallery ajax

发布于 2024-10-18 08:14:15 字数 1186 浏览 0 评论 0原文

我正在尝试在 $.ajax jquery 函数中加载 JQTouchPhotoGallery 动态图像。 但图库不显示图像,只显示加载微调器。结果中的图像数量也未正确显示在顶部栏(412 中的第 1 个)...


$(function(){
$(".folio").click(function(){
                var portfolio_id = $(this).attr('id');
                $.ajax({
                async:false,
                   type: "GET",
                   url: "portfolio.php",
                   data: "portfolio_id="+portfolio_id+"",
                   success: function(data){
                     //alert( "Data Saved: " + data );
                     jQT.generateGallery("portfolio-slides-"+portfolio_id,data);
                   }
                 });
});
});

php 的结果是:


[
{src:"../img/upload/portfolio/portfolio-2_Hochhauser1.jpg"},
{src:"../img/upload/portfolio/portfolio-2_Hochhauser2.jpg"}
]

意味着,主画廊代码脚本应该如下所示:


jQT.generateGallery("portfolio-slides2",[
{src:"../img/upload/portfolio/portfolio-1_LOOSHAUS_1.jpg"},
{src:"../img/upload/portfolio/portfolio-1_LOOSHAUS_2.jpg"}
]); 

我的 javascript 代码完全错误吗?如果我提醒数据,一切似乎都正常。或者是否有一些我没有考虑到的限制...

任何帮助将不胜感激,提前谢谢您!

问候,伯恩哈德

i'm trying to load the images for the JQTouchPhotoGallery dynamic in a $.ajax jquery function.
but the gallery doesn't show the images, only the loading spinner. also the number of images from the result are not displayed correctly at the top bar (1 of 412)...


$(function(){
$(".folio").click(function(){
                var portfolio_id = $(this).attr('id');
                $.ajax({
                async:false,
                   type: "GET",
                   url: "portfolio.php",
                   data: "portfolio_id="+portfolio_id+"",
                   success: function(data){
                     //alert( "Data Saved: " + data );
                     jQT.generateGallery("portfolio-slides-"+portfolio_id,data);
                   }
                 });
});
});

the result from the php is:


[
{src:"../img/upload/portfolio/portfolio-2_Hochhauser1.jpg"},
{src:"../img/upload/portfolio/portfolio-2_Hochhauser2.jpg"}
]

means, the main gallery code script should look like this:


jQT.generateGallery("portfolio-slides2",[
{src:"../img/upload/portfolio/portfolio-1_LOOSHAUS_1.jpg"},
{src:"../img/upload/portfolio/portfolio-1_LOOSHAUS_2.jpg"}
]); 

am i completely wrong with my javascript code?? if i alert the data, all seems to be working. or are there some restrictions which i didn't consider...

any help would be really appreciated, thank you in advance!

greetings, bernhard

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生寂 2024-10-25 08:14:15

除了传递错误的数据之外,您的代码没有任何问题。我的意思是我实际上不明白为什么你要把赋值运算符放在字符串中!这就是为什么您的图像没有被显示的原因。只需按原样使用数据,看看它是否有效

There is no problem in your code except that you are passing wrong data. I mean I actually don't understand why are you putting assignment operator in a string! That is why your image are not being shown. Just use the data as it is and see if it works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文