calling php within javascript

Running into problems trying to add this effect into a page:

http://tympanus.net/...query-and-css3/

in the javascript there is a call to a php to return json objects:




$.get('photostack.php', {album_name:album_name} , function(data) {

        var items_count = data.length;

        for(var i = 0; i < items_count; ++i){

            var item_source = data[i];

            var cnt     	= 0;

            $('<img />').load(function(){

                var $image = $(this);

                ++cnt;

                resizeCenterImage($image);

                $ps_container.append($image);

                var r   	= Math.floor(Math.random()*41)-20;

                if(cnt < items_count){

                    $image.css({

                        '-moz-transform'    :'rotate('+r+'deg)',

                        '-webkit-transform' :'rotate('+r+'deg)',

                        'transform'     	:'rotate('+r+'deg)'

                    });

                }

                if(cnt == items_count){

                    $loading.remove();

                    $ps_container.show();

                    $ps_close.show();

                    $ps_overlay.show();

                }

            }).attr('src',item_source);

        }

    },'json');

the php file contains:




$location   = 'albums';

$album_name = $_GET['album_name'];

$files      = glob('/images/.$location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE);

$encoded    = json_encode($files);

echo $encoded;

unset($encoded);

I can’t seem to have the php return any data at all. Looking from Webkit debugger, I am pretty sure I had the php file loaded. Perhaps it has something to do with the path? I put the albums folder under root.

Can anyone help? Thank you.

never mind, the problem was with the path. I solved it, now I just got to figure out how to modify it to my need.