The problem: At the moment my webpage just shows the result but as random place and google.js won't start. If i troubleshoot in concole, it shows no game_statistics.inc found. But it is there. Can it be access problem, because js file is in web folder and game_statistic.inc is folder above access? How to fix it? How should I echo results in html file, to be where I want it?
client/src/sms/gamestatistics.inc file
$GAnalytics = "SELECT GAnalyticsEST, GAnalyticsRUS FROM GAME_game WHERE id = ".$GID." ; ";
$res= mysql_query($GAnalytics);
$resul = array();
while ($row = mysql_fetch_array($res))
array_push($resul, array('GAnalyticsEST' => $row[0], 'GAnalyticsRUS' => $row[1] ));
echo json_encode(array("resul"=>$resul));
client/web/google.js code:
$(document).ready( function() {
done();
});
function done() {
setTimeout( function() {
updates();
done();
}, 9000);
}
function updates() {
$.getJSON( '../src/sms/game_statistics.inc', function(data) {
$("ul").empty();
$.each(data.resul, function(){
$("ul").append("<li>GoogleEST: "+this['GAnalyticsEST']+"</li><li>GoogleRUS: "+this['GAnalyticsRUS']+"</li><br />");
});
});
}
You can't get access to that because it's in a folder that isn't accessible to the web. If your browser can't get to it, the javascript being executed by the browser can't either.
You need to use PHP to access things outside the Apache installation. So either move that php file to the Apache www dir, or make a script to include it
<?php require_once('../../file_outside_www.php'); ?>