Problem: JSON geht nicht online

ngi

Grünschnabel
Hallo zusammen,

ich habe gerade ein riesen Problem. Ich übergebe mit PHP einen Array der in JS Verarbeitet werden soll. Es klappt lokal alles super, nur online geht es nicht. Woran kann es liegen?

PHP:
<?php 

	$dir = opendir ('images/backgrounds/rd'); 

	$backgrounds = array();

	while ($file = readdir ($dir)) { 

      if($file != "." && $file != ".."){

      	$file = str_replace(".jpg", "", $file); 

      		$backgrounds[] = $file;     	

      }

	}

	header('Content-type: application/json');
	echo json_encode($backgrounds);


	closedir($dir); 

?>

Code:
$(document).ready(function() {

		Array.prototype.search = function( value, strict )
				{
				    if( typeof value == "undefined" ) {
				        return false;
				    }
				    var retVal = false;
				    if( strict ) {
				        for( key in this ) {
				            if( this[key] === value ) {
				                retVal = key;
				                break;
				            }
				        }
				    } else {
				        for( key in this ) {
				            if( this[key] == value ) {
				                retVal = key;
				                break;
				            }
				        }
				    }
				    return retVal;
				}



		function cSlideUp(container) {

			$(container).mouseover(function() {
				$(container).animate({
				    height: '30px',
				    bottom: '16px'
				  }, 300, function() {
				    // Animation complete.
				});
			});

			$(container).mouseout(function() {
				$(container).animate({
				    height: '15px',
				    bottom: '0px'
				  }, 300, function() {
				    // Animation complete.
				});
			});

		};

	
		cSlideUp('#color1');
		cSlideUp('#color2');
		cSlideUp('#color3');
		cSlideUp('#color4');




		function cSlideStay(container) {

			$(container).animate({
				height: '30px',
				bottom: '16px'
			}, 300, function() {
				 // Animation complete.
			});

			$(container).mouseout(function() {
				$(container).animate({
					height: '30px',
					bottom: '16px'
				}, 300, function() {
					// Animation complete.
				});
			});

		};
$(function() {
			$.getJSON('http://XXXX.com/fileadmin/templates/check_dir.php', function(json) {	

				var bgImages = new Array();

				var projekt = $("#projektname").html();

				switch(projekt) {
					case 'Hotel &amp; Restaurant':
						var category = 'hotel';							
						cSlideStay('#color1');
					break;

					case 'Showroom &amp; Shop':
						var category = 'showroom';
						cSlideStay('#color2');
					break;

					case 'Fitness &amp; SPA':
						var category = 'fitness';
						cSlideStay('#color4');
					break;

					case 'Living':
						var category = 'living';							
						cSlideStay('#color3');
					break;

					default:
						var category = 'default';
				}


				var i = 1;

				while(i <= 20) {

					var indexOfJSON = json.search(category+'_'+i);

					if(indexOfJSON !== false){
						bgImages.push(json[indexOfJSON]);
					}

					i++;
										
				}
				

				$('#imgFader').css("background-image", "url(http://XXX.de/fileadmin/templates/images/backgrounds/rd/"+bgImages[0]+".jpg)");


				var count = 0;

				$('#vor').click(function() {

					if(count == bgImages.length - 1){
						count = 0;
					}			

					$('#imgFader').fadeOut(300, function() {
						 $('#imgFader').css("background-image", "url(http://XXX.de/fileadmin/templates/images/backgrounds/rd/"+bgImages[++count]+".jpg)");
					});

					$('#imgFader').fadeIn(300, function() {
						 //
					});

				});

				$('#zurueck').click(function() {

					if(count == 0){
						count = bgImages.length;
					}			

					$('#imgFader').fadeOut(300, function() {
						 $('#imgFader').css("background-image", "url(http://XXX.de/fileadmin/templates/images/backgrounds/rd/"+bgImages[--count]+".jpg)");
					});

					$('#imgFader').fadeIn(300, function() {
						 //
					});

				});


				$('#close').click(function() {
				  $('#column1').animate({
				    opacity: 'toggle'
				  }, 1000, function() {

				   $(".showhide").toggle();

				  });

				});

				$('#close').click(function() {
				  $('#sidebar').animate({
				    opacity: 'toggle'
				  }, 1000, function() {

				   $(".showhide").toggle();

				  });

				});

				

			});
		});

		

	});


Für eine schnelle Antwort wäre ich sehr dankbar. Alles ueber
Code:
$(function() {
			$.getJSON('http://XXX.com/fileadmin/templates/check_dir.php', function(json) {
laeuft ohne Probleme.


Vielen Dank und Gruß
 
Zurück