2.AngularJS使用$http.get()。
第三,$http.post實現跨域
1.設置服務器端允許在其他域名下訪問,並設置響應類型和響應頭。
response . set header(" Access-Control-Allow-Origin "," * ");
response . set header(" Access-Control-Allow-Methods "," POST ");
response . set header(" Access-Control-Allow-Headers "," x-requested-with,content-type ");
2.AngularJS使用$http.post()並同時設置請求頭信息。
$http.post(',{languageColumn:'name_eu'},{ ' Content-Type ':' application/x-www-form-urlencoded ' })。成功(函數(數據){
$ scope.industries = data
});