вот
$.each(data,function(key,value){
$.each(value, function(i, item) {
document.write(item.country + '<br>');
});
});
- выводит
undefined
если выводить так
$.each(data,function(key,value){
$.each(value, function(i, item) {
document.write(i + ' - ' + item + '<br>');
});
});
то красиво выводит ключ - значение. как быть?
вот json который приходит циклу
[
{
"0":"50.4333",
"latitude":"50.4333",
"1":"30.5167",
"longitude":"30.5167",
"2":"\u041a\u0438\u0435\u0432",
"name_ru":"\u041a\u0438\u0435\u0432",
"3":"\u0423\u043a\u0440\u0430\u0438\u043d\u0430",
"country":"\u0423\u043a\u0440\u0430\u0438\u043d\u0430",
"4":"Ukraine",
"name_en":"Ukraine",
"5":"8",
"count":"8",
"6":"49713",
"id":"49713",
"inc":1,
"all":"8"
},
{
"0":"40.3953",
"latitude":"40.3953",
"1":"49.8822",
"longitude":"49.8822",
"2":"\u0411\u0430\u043a\u0443",
"name_ru":"\u0411\u0430\u043a\u0443",
"3":"\u0410\u0437\u0435\u0440\u0431\u0430\u0439\u0434\u0436\u0430\u043d",
"country":"\u0410\u0437\u0435\u0440\u0431\u0430\u0439\u0434\u0436\u0430\u043d",
"4":"Azerbaijan",
"name_en":"Azerbaijan",
"5":"1",
"count":"1",
"6":"25990",
"id":"25990",
"inc":2,
"all":"1"
},
{
"0":"55.7522",
"latitude":"55.7522",
"1":"37.6156",
"longitude":"37.6156",
"2":"\u041c\u043e\u0441\u043a\u0432\u0430",
"name_ru":"\u041c\u043e\u0441\u043a\u0432\u0430",
"3":"\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0430\u044f \u0424\u0435\u0434\u0435\u0440\u0430\u0446\u0438\u044f",
"country":"\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0430\u044f \u0424\u0435\u0434\u0435\u0440\u0430\u0446\u0438\u044f",
"4":"Russian Federation",
"name_en":"Russian Federation",
"5":"1",
"count":"1",
"6":"23541",
"id":"23541",
"inc":3,
"all":"1"
}
]