[{
"code": "Free",
"type": "base",
"name": "Start",
"price": "Free",
"subscriptionunit": "month",
"subscriptionqty": 1,
"customizable": false
}]
のように私のJSONファイル別々のサーバーと私のWebサーバーでこのJSONファイル私は同じ、同じサーバーと同じプロジェクトからJSON詳細を取得するには、次のようにコード化された別のサーバ。
$http({
method: 'GET',
url: './json/priceplan.json',
dataType: "json",
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, X-Requested-With",
"Content-Type": "text/json"
},
})
.success(function (data) {
console.log("Ok : " + data);
})
.error(function (data) {
console.log("Error : " + data);
});
別のサーバーでjsonファイルを取得する方法を知りたい。
を購入する必要がいけない場合:http://stackoverflow.com/questions/10636611/how -does-access-control-allow-origin-header-work –