Есть AJAX, который получает JSON в котором три записи.
{"id_user":12,"family":"\u0411\u043e\u043b\u044c\u0448\u0430\u043a\u043e\u0432","name":"\u041c\u0438\u0445\u0430\u0438\u043b","surname":"\u041d\u0438\u043a\u043e\u043b\u0430\u0435\u0432\u0438\u0447","id_users_group":2,"user_gruop_short":"doctor","user_gruop_full":"\u0412\u0440\u0430\u0447","username":"bolshakov","password":"931ce360a92ae1786dab47686913edf7","commentaries":"bolshakov","active":1,"PHPSESSID":"55v8hqla89k5uudiolri4lnb33"}{"id_user":13,"family":"\u0411\u044b\u0447\u043a\u043e\u0432\u0430","name":"\u0418\u0440\u0438\u043d\u0430","surname":"\u042e\u0440\u044c\u0435\u0432\u043d\u0430","id_users_group":4,"user_gruop_short":"doctor_ordinator","user_gruop_full":"\u0412\u0440\u0430\u0447-\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440","username":"bichkova","password":"e768e9c4cfca65edb88fd1c81bcef67b","commentaries":"bichkova","active":1,"PHPSESSID":"55v8hqla89k5uudiolri4lnb33"}{"id_user":14,"family":"\u0411\u0430\u0442\u043b\u0435\u0440","name":"\u0413\u0430\u0431\u0440\u0438\u0435\u043b\u044c","surname":"\u0410\u043c\u0438\u0440\u0430\u043d\u043e\u0432\u0438\u0447","id_users_group":5,"user_gruop_short":"no_group","user_gruop_full":"\u041d\u0415 \u0417\u0410\u0414\u0410\u041d\u0410","username":"batler","password":"bfce8b4b938d6d4a65b2ecf813ca49bd","commentaries":"batler","active":0,"PHPSESSID":null}
Сам запрос...
$("#query_search").keyup(function (e) {
if (e.which === 13 && $("#query_search").val().length > 0) {
$.ajax({
url: "../../php/search_user.php",
async: false,
type: 'POST',
data: {
query_search: $("#query_search").val()
},
success: function (data, textStatus, jqXHR) {
$("#result").empty();
data = jQuery.parseJSON(data);
//как засунуть data в цикл, чтоб получить все записи?
}
});
}
});
Когда приходит одна запись, я знаю как обработать строку, а когда две, не знаю. Как сделать цикл?