Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/439.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从angular发布数据时出现404未找到问题,但在get请求期间不会出现404未找到错误_Javascript_Json_Angularjs_Node.js - Fatal编程技术网

Javascript 从angular发布数据时出现404未找到问题,但在get请求期间不会出现404未找到错误

Javascript 从angular发布数据时出现404未找到问题,但在get请求期间不会出现404未找到错误,javascript,json,angularjs,node.js,Javascript,Json,Angularjs,Node.js,这是我的目录结构- app.js 具有JSON文件的公共资源 $http({ url : url, method : 'GET', headers : { 'Content-Type' : 'application/json' } }).success(function(data,status,headers,config){ $rootScope.home=data; console.log($rootScope.home.quo

这是我的目录结构-

app.js 具有JSON文件的公共资源

$http({
    url : url,
    method : 'GET',
    headers : {
        'Content-Type' : 'application/json'
    }
}).success(function(data,status,headers,config){
    $rootScope.home=data;
    console.log($rootScope.home.quotes);
}).error(function(data, status, headers, config){
    console.log("Error comes");
});
这是我获取JSON文件的控制器

$http({
    url : url,
    method : 'GET',
    headers : {
        'Content-Type' : 'application/json'
    }
}).success(function(data,status,headers,config){
    $rootScope.home=data;
    console.log($rootScope.home.quotes);
}).error(function(data, status, headers, config){
    console.log("Error comes");
});
上面的控制器get请求没有为未找到的JSON文件提供任何错误

这是我的邮局管理员

var url = "Resources/JSON/home.json";

$http({
    method : 'POST',
    url : url,
    data : requestObject,
    headers : {'Content-Type' : 'application/json'}         
}).success(function(data, status, headers, config){
    console.log("This is will execute when there is some response");
}).error(function(data, status, headers, config){
    console.log("Error Comes while editing the stuff");
});
此错误为www.localhost:8000/Resources/JSON/home.JSON未找到错误

有人能帮我解决这个问题吗


提前感谢

这可能是服务器端的配置错误,但很难说没有看到任何代码。您使用哪台服务器接收json数据?
www.localhost
是这样吗?是否有可能是
localhost:8000..
呢?@mcdex我有app.js,其代码var express=require('express');var-app=express();console.log(uu dirname);app.use(express.static(uu dirname+/public));var port=process.env.port | 8000;app.listen(端口);是的,localjost是对的,当我在GoogleDeveloper工具中转到网络选项卡时,它显示它没有找到,但是当我在新窗口选项卡中复制相同的url时,它会返回JSON数据