如何在angular.js中处理ajax请求中的json数据

如何在angular.js中处理ajax请求中的json数据,json,ajax,angularjs,header,Json,Ajax,Angularjs,Header,我正在使用angular.js。我正在发出一个ajax请求并得到如下响应 Http响应: HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: application/json Date: Mon, 26 Oct 2015 06:37:40 GMT {"status":1} 但是angular js无法自动解析json数据。但是当我只返回{status:1}作为响应时,它工作得很好。我认为当我们发送消息时,应该自动检测

我正在使用angular.js。我正在发出一个ajax请求并得到如下响应

Http响应:

HTTP/1.0 200 OK
Cache-Control: no-cache
Content-Type:  application/json
Date:          Mon, 26 Oct 2015 06:37:40 GMT

{"status":1}
但是angular js无法自动解析json数据。但是当我只返回{status:1}作为响应时,它工作得很好。我认为当我们发送消息时,应该自动检测json


谢谢

请发布您的代码……这是angularjs中用于ajax请求的代码$http{method:'post',url:'index.php',/*responseType:'json',*/data:{},}。然后是$scope.successfn,$scope.errorfn$scope.successfn=functionresponse{var data=response.data;ifdata.status==0{alert'Error,请重试。;}否则{alert'已成功保存。;}}$scope.errorfn=function{alert'Error';}`@KhalidHussain对未格式化的代码表示抱歉: