[support] refreshing jcarousel item list without page reload

Christopher M. Jones cjones at partialflow.com
Thu Nov 18 14:29:55 UTC 2010


... and how to integrate it into the carousel? Go back to the jcarousel 
examples using ajax dynamic loading. Something like this:

   $.get(url, function(data){
     $.each(data, function(){
       carousel.add(data);
     });
   });

But what you're getting back in the json below is just properties and 
values. carousel.add() needs markup. to make things easier you might put 
the actual markup into the array in your callback function:

   $items = array();
   foreach( $awards as $award ){
     array_push($items, '<img src="...">');
   }

   print drupal_to_js($items);

That's it, apart from what else you might do to avoid duplicates the in 
the carousel, reordering items, and scrolling the user to the proper 
item. Again, see jcarousel docs for this.

But you realize that if you just use a view then you don't have to write 
the page callback.

On 11/18/2010 09:15 AM, Aldo Martinez Selleras wrote:
> Thanks for all your advices!
>
> What can I do with the JSON data?
>
> If I have this?
>
> [{"username":"skipper","background":"background_02.jpg","model":"trophy_001"
> ,"title":"The Best runner","category":"Default","date":"Tue, 15 Nov
> 2010","material":"silver"},{"username":"skipper","background":"background_01
> .jpg","model":"trophy_002","title":"The Best
> Player","category":"Default","date":"Tue, 16 Nov 2010","material":"gold"}]
>
> How I use this data for generate my carousel ?
>
>


More information about the support mailing list