JQTouchPhotoGallery ajax

290 Views Asked by At

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

1

There are 1 best solutions below

1
On

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