How do I return the following json data in a succesfull array:
[{"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"}]
I want to get this in an array an call for example data.Naam where id = 2.
If u use this code:
$.post( "http://notGiven", {}, function(data) {
alert('Aantal elementen in lijst: ' + data.length);
$.each(data, function(index, element) {
});
});
then data length gives me a number above 3000 why that.
And if i try element.Naam in the loop then it returns undefined…
So.. How do i get the data which my json returns, like all the names?? without showing undefined errors…
as @Utkanos said,
the solution is here: http://jsbin.com/equkaf/6/edit