Google 存储 Ajax 加载 Json 文件不工作
Google Storage Ajax load Json File not working
我正在 html 中使用 ajax 加载 Json 个文件,数据将每 5 秒刷新一次。
当我在本地主机上测试时,一切正常。但是,当我上传到 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>
我无法让它在 google 存储中工作,有人知道吗?
非常感谢。
终于想通了。
为了让它工作,我需要打开 html 文件的 public link,并将 json 文件设置为 'no-cache'确保 html.
会立即获取新上传的数据
非常感谢,如有不妥欢迎大家评论交流。
我正在 html 中使用 ajax 加载 Json 个文件,数据将每 5 秒刷新一次。
当我在本地主机上测试时,一切正常。但是,当我上传到 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>
我无法让它在 google 存储中工作,有人知道吗?
非常感谢。
终于想通了。
为了让它工作,我需要打开 html 文件的 public link,并将 json 文件设置为 'no-cache'确保 html.
会立即获取新上传的数据非常感谢,如有不妥欢迎大家评论交流。