通过这段代码,我试图从服务器获取数据
$scope.get_file_list = function() {
delete $http.defaults.headers.common['X-Requested-With']; //We don't wat OPTIONS but GET request
$http({method: 'GET', url: backendUrl + '/session/' + $scope.id + '/list'})
.success(function(data, status, headers, config) {
// ...
})
.error(function(data, status, headers, config) { console.log(
'error\ndata: '+data+
'\nstatus: '+status); });
服务器:
^{pr2}$这里是浏览器的控制台输出
[18:58:37.409] "error
data:
status: 0
服务器用代码200响应,当我用浏览器测试它时,一切正常(服务器发送数据时没有在控制台发出任何警告)。 也许我应该用jQuery来做这个?在
状态码0可能是由于跨域请求(即webapp已打开foo.com网站服务器已打开酒吧网)或无法访问的服务器。如需更详细的解释,请查看
ajax status = 0
jQuery Ajax - Status Code 0?
相关问题 更多 >
编程相关推荐