我在从文件加载JSON内容时遇到困难.console.log打印"server-side failure with status code 0",表示请求失败.
我的JSON文件URL正确,文件出现在给定的地址.
Firebug显示错误:
"NetworkError: 405 Not Allowed - http://localhost:8080/4910.json?_dc=1336714070619
Run Code Online (Sandbox Code Playgroud)
并且Net标签显示状态405 not allowed.
有关为什么会发生这种情况的任何想法?
Ext.Ajax.request({
url: 'http://localhost:8080/4910.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.log(obj[0].name);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
Run Code Online (Sandbox Code Playgroud)
另外,将参数添加_dc=1336714070619到GET请求的末尾是什么?
仅供参考..
对于谁正在添加参数_dc.dc代表禁用缓存.
默认情况下,extjs中的每个请求都会自动使用_dc附加请求变量.更多信息
如果您不想要它,只需设置disableCaching: false您的请求即可
Ext.Ajax.request({
disableCaching: false,
url: 'http://localhost:8080/4910.json',
......
});
Run Code Online (Sandbox Code Playgroud)
对于为什么不允许.
尝试打开JSON URL路径_dc,或者可能是您的服务器出现了问题.
| 归档时间: |
|
| 查看次数: |
23969 次 |
| 最近记录: |