如何在成功的数组中返回以下json数据:
[{"Identifier":1,"Naam":"NOT Given","Adres":"Kopenhagen 9","Postcode":"0000LL","Plaats":"NOT Given","Longitude":"0.00000","Latitude":"0.00000"},
{"Identifier":2,"Naam":"NOT Given","Adres":"NOT Given 1","Postcode":"0000LL","Plaats":"Rotterdam","Longitude":"0.00000","Latitude":"0.00000"},
{"Identifier":3,"Naam":"NOT Given","Adres":"NOT Given 6","Postcode":"0000LL","Plaats":"Rotterdam","Longitude":"0.00000","Latitude":"0.00000"},
{"Identifier":4,"Naam":"NOT Given","Adres":"NOT Given 1","Postcode":"0000LL","Plaats":"Den Haag","Longitude":"0.00000","Latitude":"0.00000"},
{"Identifier":5,"Naam":"NOT Given","Adres":"NOT Given 218","Postcode":"0000LL","Plaats":"Zoetermeer","Longitude":"0.00000","Latitude":"0.00000"}]
我想在数组中调用例如data.Naam,其中id = 2。
如果您使用此代码:
$.post( "http://notGiven", {}, function(data) {
alert('Aantal elementen in lijst: ' + data.length);
$.each(data, function(index, element) {
});
});
然后数据长度给出了3000以上的数字。
如果我在循环中尝试element.Naam,那么它将返回undefined ...
那么..我如何得到我的json返回的数据,就像所有的名字一样?没有显示未定义的错误......