2014-04-08 2 views
0

문제 : 현재 내 웹 페이지에는 결과가 표시되지만 임의의 장소와 google.js는 시작되지 않습니다. concole에서 문제를 해결하면 game_statistics.inc가 발견되지 않습니다. 그러나 그것은 거기에있다. js 파일이 웹 폴더에 있고 game_statistic.inc가 액세스 위의 폴더이기 때문에 액세스 문제 일 수 있습니까? 그것을 고치는 방법? 결과를 html 파일로 에코하려면 어떻게해야합니까?jquery가 포함 된 루트 폴더 php에 액세스 할 수 없습니다.

클라이언트/SRC/SMS/gamestatistics.inc 파일

$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)); 

클라이언트/웹/google.js 코드 :

$(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 />"); 
    }); 
}); 
} 

답변

1

이 폴더에 있기 때문에 당신은 그에 대한 액세스 권한을 얻을 수 없다 웹에 액세스 할 수 없습니다. 귀하의 브라우저가 그것에 도달 할 수 없다면, 브라우저에 의해 실행되고있는 자바 스크립트 역시 그렇게 할 수 없습니다.

0

PHP를 사용하여 Apache 설치 외부에있는 항목에 액세스해야합니다. 따라서 PHP 파일을 Apache www dir로 이동하거나 포함시킬 스크립트를 만드십시오.

<?php require_once('../../file_outside_www.php'); ?> 
관련 문제