这应该非常直截了当,但即便是看着其他问题,我也不能让它工作。
I m 检索一些来自以下链接的世界银行数据:
该网络的结构如下:
getWorldBankData([
{
"page": 1,
"pages": 1,
"per_page": "100",
"total": 52
},
[
{
"indicator": {
"id": "DC.DAC.FINL.CD",
"value": "Net bilateral aid flows from DAC donors, Finland (current US$)"
},
"country": {
"id": "GB",
"value": "United Kingdom"
},
"value": null,
"decimal": "0",
"date": "2011"
},
{
"indicator": {
"id": "DC.DAC.FINL.CD",
"value": "Net bilateral aid flows from DAC donors, Finland (current US$)"
},
"country": {
"id": "GB",
"value": "United Kingdom"
},
"value": null,
"decimal": "0",
"date": "2010"
},
我想获得各国的名称。 我一直试图用以下法典这样做:
function getWorldBankData(json){
$.each(json.country ,function(){
var country = "<option>"+this.value+"</option>"
$( #category ).append(country)
});
}
但我有以下错误:
a is undefined
f()jquery.min.js (line 16)
a = undefined
c = function()
d = undefined
getWorldBankData()oil.js (line 11)
json = [Object { page=1, pages=1, per_page="100", more...}, [Object { indicator={...}, country={...}, decimal="0", more...}, Object { indicator={...}, country={...}, decimal="0", more...}, Object { indicator={...}, country={...}, decimal="0", more...}, 49 more...]]
DC.DAC.FINL.CD?per_page=100&date=1960:2012&format=jsonP&prefix=getWorldBankData()DC.DAC...ankData (line 1)
[Break On This Error]
...all(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)...
这条线(第11条):
$.each(json.country ,function(){
怎样才能使国家受益? 感谢。