Ajax sample file
|
|
Hi @ all, I try to get the ajax sample files to work with php and json. 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? |