2014-01-08 41 views
0

我是一直得到403 Forbidden錯誤,我不能夠讓我的JSON數據在所有...這是我的HTML源代碼:爲什麼我一直得到403禁止的問題?

<html> 
<head> 
    <meta name="keywords" content="jquery,ui,easy,easyui,web"> 
    <meta name="description" content="easyui help you build your web page easily!"> 
    <title>jQuery EasyUI Demo</title> 
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> 

</head> 
<body> 
    <h1>TreeGrid</h1> 
    <script> 
     (function(){ 
      $.getJSON("data/data.json", function(data){ 
        console.log(data); // i am not getting data here 
      }); 
     })(); 

    </script> 
</body> 
</html> 

的URL路徑是正確的。我得到的錯誤爲:

GET http://localhost/~xxxxxx/dataTest/data/data.json 403 (Forbidden) 

我該如何解決這個問題?

+0

當您嘗試直接訪問http://localhost/~xxxxxx/dataTest/data/data.json時會發生什麼? – Osiris

+0

對不起,我越來越喜歡這樣:Forbidden 您無權訪問此服務器上的/~xxxxx/dataTest/data/data.json。 Apache/2.2.24(Unix)DAV/2 PHP/5.3.26與本地主機端口80 Suhosin-Patch服務器 – 3gwebtrain

回答

1

嘗試把文件中的根文件夾,然後訪問它。它可以幫助您排除無法訪問權限下的根文件夾的問題。

+0

我試過你的方法,它的工作原理!那麼有什麼問題,我無法從嵌套文件夾訪問? – 3gwebtrain

+0

很高興我能幫忙,你解決了嗎? –