亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問使用angular中的$http報錯是為什么

請問使用angular中的$http報錯是為什么

呆呆呆 2017-07-04 10:15:35
<!DOCTYPE?html> <html?ng-app="demo2"> <head> ????<meta?charset="UTF-8"> ????<title>表格</title> ????<script?src="js/angular.js"></script> ????<script?src="js/biaogeTest.js"></script> </head> <body> ????<div?ng-controller="customersCtrl"> ????????<table> ????????????<tr?ng-repeat="x?in?names"> ????????????????<td>{{?x.Name?}}</td> ????????????????<td>{{?x.Country?}}</td> ????????????</tr> ????????</table> ????</div> </body> </html>/** ?*?Created?by?tongwii?on?2017/7/4. ?*/ var?app?=?angular.module('demo2',[]); app.controller('customersCtrl',function?($scope,$http)?{ ????$http.get("http://www.runoob.com/try/angularjs/data/Customers_JSON.php") ????????.then(function?(result)?{ ????????????$scope.names?=?result.data.records; ????????}); });錯誤信息biaogeTest.html:1?XMLHttpRequest?cannot?load?http://www.runoob.com/try/angularjs/data/Customers_JSON.php.? No?'Access-Control-Allow-Origin' ?header?is?present?on?the?requested?resource.?Origin?'http://localhost:63342'? is?therefore?not?allowed?access. angular.js:14525?Possibly?unhandled?rejection:?{"data":null,"status":-1,"config":{"method":"GET", "transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback", "url":"? "headers":{"Accept":"application/json,?text/plain,?*/*"}},"statusText":""} (anonymous)?@?angular.js:14525在網上查是說ajax跨域,請問這個如何解決?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 1 關注
  • 4374 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號