diff --git a/autocomplete_ajax.php b/autocomplete_ajax.php index 1b1714ca4..f05088188 100644 --- a/autocomplete_ajax.php +++ b/autocomplete_ajax.php @@ -115,12 +115,12 @@ } $data = $sug = []; - for ($i = 0; $i < count ($ret); $i++) { - $sug[$i] = $ret[$i]['name']; - } - for ($i = 0; $i < count ($ret); $i++) { - $data[$i] = $ret[$i]['text']; + + foreach ( $ret as $i ) { + $sug[] = $i['name']; + $data[] = $i['text']; } + ajax_send_object('matches', $sug, $sendPlainText); } else { ajax_send_error(translate("Error"));