【发布时间】:2019-09-27 22:56:41
【问题描述】:
当我在安装了 Apache 的 Arch Linux 机器上转到 localhost 时,以下代码成功加载了 JSON 文件。
$.getJSON("geo/my.json",function(jsonStuff){
// Code here
})
但是当我导航到由 Microsoft Azure 提供支持的服务器时,我的 Web 浏览器控制台会显示此消息。
GET https://path/to/my.json 404 (Not Found)
我知道文件和文件夹在那里,因为我通过 FileZilla 将它们传输到远程服务器。当我使用 FileZilla 打开包含my.json 的文件夹时,我看到了那里的文件。
根目录如下所示。
index.html
geo
my.json
js
script.js
当我将浏览器导航到 https://path/to/my.json 时,我看到了这条消息。
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable..
为什么$.getJSON 不能在我的远程服务器上工作?
【问题讨论】:
-
您是否在 Apache 中正确设置了站点的根目录?如果你去
https://yoursite.com/会打开你的 index.html 文件吗?通常看起来像DocumentRoot /var/www/yoursite/htdocs
标签: javascript jquery json azure getjson