Answer the question
In order to leave comments, you need to log in
How to loop through an array in jquery?
Good afternoon, I can not figure out how to split the array correctly.
I am making a request via Ajax. On the server there is a selection in basis.
while ($res = mysql_fetch_array($query)){
echo json_encode([
'family'=>$res['family'],
'name'=>$res['name']
]);
}
var obj = JSON.stringify(data)
data = JSON.parse(obj);
{"family":"Петров","value":"Иван"}
{"family":"Иванов","value":"Петр"}
{"family":"Сидоров","value":"Вадим"}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question