为了账号安全,请及时绑定邮箱和手机立即绑定

如何用angular获取json文件

如何用angular获取json文件

森林海 2018-08-02 10:10:24
在自己本地的服务器上运行,但是chrome下一直报错,angular.min.js:103XMLHttpRequest cannot load localhost:80/angular/data.php. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.这是first.html中的代码var app=angular.module('myApp',[]);app.controller('myCtrl',function($scope,$location,$timeout,$http){    $http.get("http://localhost/angular/data.php")         .success(function(response){$scope.data=response.records;});})        这是data.php中的,{"name":"张春林","age":"20","school":{    "name":"八十三中",    "location":"咸宁中路"    }}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1413 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信