Thanks for all your input, I got it working:

        $handle = opendir($currentBeerDir);
        $first = true;
        while (false !== ($file = readdir($handle))){  // iterate over
all json files in directory
                          $extension = strtolower(substr(strrchr($file, '.'), 
1));
                          if($extension == 'json' ){
                                        for ($i = 1; $i <= 10; $i++) { //try 10 
times, file might be in
use
                                                $jsonFile =  $currentBeerDir . 
'/' . $file;
                                                if(is_readable($jsonFile)){
                                        ?>
                                          var jsonData = $.ajax({
                                                url: <?php echo '"' . $jsonFile 
. '"' ?>,
                                                dataType:"json",
                                        async: false
                                  }).responseText;
                                  var evalledJsonData = eval("("+jsonData+")");

                                                                <?php
                                                                if($first){
                                                                        ?>
                                                                                
combinedJson = evalledJsonData;
                                                                        <?php
                                                                        $first 
= false;
                                                                }
                                                                else{
                                                                        ?>
                                                                                
combinedJson.rows  =
combinedJson.rows.concat(evalledJsonData.rows);
                                                                        <?php
                                                                        $first 
= false;
                                                                }
                                            break;
                                    }
                                        else{
                                        time_nanosleep(0,1000000);
                                    }
                                        }
        //                              break;
                                }
                        }
                        ?>
                        beerData = new 
google.visualization.DataTable(combinedJson);

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to