我正在使用这个ajax来调用json文件,但不知怎的,我不断收到此错误消息:“Access-Control-Allow-Origin不允许使用Origin null。”
这是我从学校内部网URL调用的代码。
$.ajax({
type:"get",
url:"http://172.20.192.218:8080/DC_Local/rest/datacorrelation?type=/soccer/football_team&limit=20",
dataType: json,
success: function(data){
var pts = [];
$.each(json.data, function(i,v){
pts.push([v.topic, v.audience.length]);
});
},
error: function (){
alert("Error");
}
});
这是我的json结构:
"data": [
{
"id": "/en/chelsea_fc",
"topic": "Chelsea F.C.",
"audience": [
{
"userid": "100003914111287",
"information": [
{
"category": "Athlete",
"source": "Didier Drogba"
},
{
"category": "Athlete",
"source": "Frank Lampard"
},
{
"category": "Professional sports team",
"source": "Chelsea Football Club"
},
{
"category": "favorite_teams",
"source": "Chelsea Football Club"
}
]
},
{
"userid": "100003914111287",
"information": [
{
"category": "Athlete",
"source": "Didier Drogba"
},
{
"category": "Athlete",
"source": "Frank Lampard"
},
{
"category": "Professional sports team",
"source": "Chelsea Football Club"
},
{
"category": "favorite_teams",
"source": "Chelsea Football Club"
}
]
}
],
"type": "/soccer/football_team"
},
{
"id": "/en/manchester_united_fc",
"topic": "Manchester United F.C.",
"audience": [
{
"information": [
{
"category": "Athlete",
"source": "Ryan Giggs"
},
{
"category": "Professional sports team",
"source": "Manchester United"
},
{
"category": "favorite_teams",
"source": "Manchester United"
}
],
"userid": "100003921730958"
}
],
"type": "/soccer/football_team"
}
]
}