Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.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
Angularjs 在调用服务器托管文件时返回未定义的get请求_Angularjs - Fatal编程技术网

Angularjs 在调用服务器托管文件时返回未定义的get请求

Angularjs 在调用服务器托管文件时返回未定义的get请求,angularjs,Angularjs,有什么原因不起作用吗 $http.get('http://localhost:8383/api/login.php').respond(function (method, url, data, headers) { return authorized ? [200, customers] : [401]; }); 我知道另一种方法,但我想知道为什么这不起作用,因为它似乎符合文档中的语法 safari:“未定义不是函数” chrome:“err\u empty\u response

有什么原因不起作用吗

$http.get('http://localhost:8383/api/login.php').respond(function (method, url, data, headers) {
     return authorized ? [200, customers] : [401];
  });
我知道另一种方法,但我想知道为什么这不起作用,因为它似乎符合文档中的语法

safari:“未定义不是函数”

chrome:“err\u empty\u response”


衷心感谢你的帮助。。。非常感谢

据我所知,没有方法响应:-)

使用有错误的
成功
或使用
然后

$http.get('http://localhost:8383/api/login.php').
  success(function(data, status, headers, config) {
    // this callback will be called asynchronously
    // when the response is available
  }).
  error(function(data, status, headers, config) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.
  });


$http.get('http://localhost:8383/api/login.php')
  .then(function(result) {
    //USe result here
});

很高兴能帮助您:-)