Forums Carousel

Ajax sample file

Subscribe to Ajax sample file 0 post(s), 1 voice

 
Avatar aldorado 3 post(s)

Hi @ all,

I try to get the ajax sample files to work with php and json.
My PROBLEM! I can´t see anything in the carousel. There are no images! Is this a problem with my Json output (please see below).
The scripts look like this. Would be nice if someone could help me out to get the sample files work.

Ajax Script

<script type="text/javascript">
    // <![CDATA[
      // Delay response
      Ajax.Request.prototype.originalInitialize = Ajax.Request.prototype.initialize;
      Ajax.Request.prototype.initialize = function(url, options) {
        options.onSuccess = options.onSuccess.wrap(function(proceed, request, json) {
          proceed.curry(request, json).delay(1);
        });
        this.originalInitialize(url, options);
      }

      var carousel = null;
      function runTest() {

        carousel = new UI.Ajax.Carousel("horizontal_carousel", {url: "json_output.php", elementSize: 250})
          .observe("request:started", function() {
                $('spinner').show().morph("opacity:0.8", {duration:0.5});
            })
          .observe("request:ended", function() {
                $('spinner').morph("opacity:0", {duration:0.5, afterFinish: function(obj) { obj.element.hide(); }});
            });
      }

      Event.observe(window, "load", runTest);

    // ]]>
    </script>

PHP -> JSON Output (json_output.php)

{"html":"<li><img src="../../../../../1120840905.jpg" /></li><li><img src="../../../../../1124793919.jpg" /></li>","from":1,"to":10,"more":true}

I also tried to put the lines above in a json_output.txt file and changed …

carousel = new UI.Ajax.Carousel("horizontal_carousel", {url: "json_output.txt", elementSize: 250})

Result: Same problem, I can´t see the pictures.

Anyone an idea?
Regards

Forums Carousel