2016-08-25 49 views
-1

我在html中使用ajax來加載Json文件,數據每5秒刷新一次。Google存儲Ajax負載Json文件不能正常工作

當我在本地主機上測試它時,一切正常。然而,當我上傳到Google雲存儲,它給了我作爲

Failed to load resource: the server responded with a status of 404() 
GET https://00e9e64bac97921ce699e88ff28fbd14910d2de64676b68d82-apidata.googleus…/storage/v1/b/../o/TableGenerationData.json 400() 

我把JSON文件在同一文件夾與HTML顯示了一些錯誤,我的代碼是肯定的工作,

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> 
<script type="text/javascript"> 
function refreshData() 
    { 
     var tt = $.ajax({ 
     url: "TableGenerationData.json", 
     dataType: "json", 
     async: false 
     }); 
     var jsonData = tt.responseJSON; 
    } 
</script> 

我無法在谷歌存儲中工作,有沒有人有任何想法?
非常感謝。

回答

0

終於搞明白了。

爲了使它工作,我需要打開html文件的公共鏈接,並將json文件設置爲'no-cache',以確保新上傳的數據將立即由html獲取。

非常感謝您,如果我錯了,歡迎發表評論並分享您的想法。