守则:
function readfile(company)
{
var url = "JSON/" + company + ".json"
$.get(url,function(data){
parse(data)
})
.fail(function(jqXHR, textStatus, errorThrown){
console.log("FAILURE!");
console.log(errorThrown)
console.log(textStatus);
console.log(jqXHR);
});
}
回应:
FAILURE! reader.js:10
SyntaxError {} reader.js:11
parsererror reader.js:12
Object {...}
让我失望的是网络选项卡显示JSON已加载,jqXHR中的响应状态为200,“OK”等等...但是jQuery一直在运行.fail()
检查了json here,它显示它是有效的,netbeans / eclipse也是如此(试图覆盖我所有的基础),而jquery仍然说没有。
网络工具将application/json
显示为mime类型,
Request Method:GET
Status Code:304 Not Modified
虽然jqXHR显示
status: 200
显然我做错了什么。有什么想法吗?
注意:不是跨源请求,在运行WAMP的localhost上,服务器在线。已插入监视器。